473,471 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP get directory and switch image (and css)

1 New Member
Hi all, I am quite the PHP idiot. I know about includes and am trying to slowly learn more but I've got to figure this out fast (as usual). I have a drop-down menu that uses CSS, combined with top-level images. I would like to use PHP to check the current directory of the current page and, based on the directory, do two things: 1) determine which image to load for the menu and 2) change the background color of the drop-down menu beneath the image. So, for example, if we are in the directory "Faculty and Staff," then the image that loads for that the Faculty and Staff drop down menu is the white one ("selectedFacStaff.gif") and the menu that appears when you hover over it has "background-color:white" rather than "background-color:#ffffcc". I would appreciate any gentle advice you can give me. I tried request_uri just to check it against the current directory, but don't know how to split the return to get just the directory (is there some way to use a wild card, like request_uri and check if it equals "facstaff/*")? thanks much!!!!!
Oct 27 '06 #1
1 2584
raji20
28 New Member
This will give you the working directory, so you can use this, hope this is helpfull to you

[php]
$fetch = $_SERVER["PHP_SELF"];
$expval = explode("/",$fetch);
$fcnt = count($expval);
$fval = $expval[$fcnt-2];
$workingDir = $fval;
[/php]
Oct 27 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: John | last post by:
I´m trying to find out how to switch between an image by a mouseclick. The function should check if the image is on or off but it doesn´t work. What´s wrong? Below the script. start_on ...
13
by: Richard | last post by:
I've been looking at implementing switch/case on my photo gallery. Most of the sites I've seen so far, only show the bare basics. With no real practical examples. As brucie does with his...
8
by: nick | last post by:
I have a problem and I've been using a cheezy work around and was wondering if anyone else out there has a better solution. The problem: Let's say I have a web application appA. Locally, I set...
8
by: gil | last post by:
Is it possible to prevent a browser from listing the entire contents of a folder? The site, is hosted on my ISP with the following layout- site/ "user name from ISP" pagefile (dir)...
5
by: Laphan | last post by:
Hi All Just to confirm, is it true that you can't change the image of an <INPUT TYPE="IMAGE".... from within a CSS styelsheet? I know the standard command is SRC="....", but there doesn't seem...
2
by: news.sbcglobal.net | last post by:
I hope I can explain this well enough to understand. I have a master page that is used by almost all of the pages in my site. On the master page is a table. In one of the cells in this table, I...
4
by: JJ | last post by:
My master page contains various graphics that are referenced from the images folder. As long as the container pages are at the same level (ie. the top level looking at the solution explorer in...
4
by: JoJo | last post by:
I followed along in Jeremy Keith's book "DOM Scripting" on how to make a image viewer that changes on clicking links. It is up for demo at: http://jojowebdesign.com/dom1.html My question is...
4
by: karsting | last post by:
I am using this css. I have a link from the thumbnail to another page, but need to go to the same link on the pop-up image. IN STYLES } .thumbnail{ position: relative; z-index: 0;
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.