Bad Credit Mortgages - Loans - Bad Credit Mortgages - Secured Loans - Loans

PDA

View Full Version : active menu


pitttih
Feb 6th 2008, 9:21 am
i want to create tabbed menus for my website. ( with php )
here is an example, click on one of those menu to see.. : http://citehealth.com

i want if menu is active.. For example, if I'm on the About Us page of a website, the About Us navigational tab should use a class. (css)

the code should be something like this :

<li (start php)class="blah"(end php)><a href="/blah"></a></li>

php code should be inside (start php) and ended at (end php)

Thanks,

LittleJonSupportSite
Feb 6th 2008, 9:59 am
why not do it like...


<li (start php)class="<?= $class ?>"(end php)><a href="/sometab?class=homepage"></a></li>


Then do everything in CSS for whatever the $class variable will hold?

Highlight it a different color bring to front etc etc.

m0nkeymafia
Feb 6th 2008, 10:05 am
A basic version would be something like this:
if ($_SERVER['PHP_SELF'] == $currentlink) { $class == "current"; }

However you would need to either manually set $currentlink, or create some class / function to do it for you.

pitttih
Feb 6th 2008, 10:13 am
Thanks for your reply!
but can you explain me a little more ?
I'm newbe in php.

can i use this like this without anything extra?

<li <?php if ($_SERVER['PHP_SELF'] == $currentlink) { $class == "current"; }; ?><a href="/blah"></a></li>

can you write a full solution for me please?

please help ..:confused:

pitttih
Feb 8th 2008, 4:01 pm
can anyone help me please ?!:confused: