472,805 Members | 1,047 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

PHP get directory and switch image (and css)

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 2569
raji20
28
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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.