Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Current Page

General discussions related to php

Moderators: macek, egami, gesf

Current Page

Postby jonnyphp » Tue Jun 05, 2012 8:21 am

Hi,

Hope someone can help, i'm new to php and got a $thispage="" function so that the css changes on the menu when selected. The problem I have is that I have on one of the menu options I have a submenu and on each of these pages I want the css to highlight on the main navigation and the sub navigation menu.

I use <li<?php if ($thisPage=="Home") echo " id=\"currentpage\"";?>><a href="home.php">Home</a></li> for my page menu settings.

Any help would be appreciated

thanks in advance.
jonnyphp
New php-forum User
New php-forum User
 
Posts: 6
Joined: Tue Jun 05, 2012 7:31 am

Re: Current Page

Postby Nullsig » Tue Jun 05, 2012 8:35 am

So what is going wrong?
User avatar
Nullsig
php-forum Fan User
php-forum Fan User
 
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Re: Current Page

Postby jonnyphp » Tue Jun 05, 2012 10:46 am

Sorry, yes.

Basically I can only give the parent menu item a single $thisPage name or can I, i did try something like if($thisPage=="home")||($thisPage=="about") which does use both, but if i add a third it doesnt seem to work. Any help would be great.

thanks again.
jonnyphp
New php-forum User
New php-forum User
 
Posts: 6
Joined: Tue Jun 05, 2012 7:31 am

Re: Current Page

Postby Nullsig » Tue Jun 05, 2012 11:23 am

You could use your function to define Parent, Child, and (if necessary) Grandchild
User avatar
Nullsig
php-forum Fan User
php-forum Fan User
 
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Re: Current Page

Postby jonnyphp » Tue Jun 05, 2012 11:38 am

Sorry, being a dimwit, how would i do that?

thanks
jonnyphp
New php-forum User
New php-forum User
 
Posts: 6
Joined: Tue Jun 05, 2012 7:31 am


Return to PHP General

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.