Current Page

General discussions related to php

Moderators: macek, egami, gesf

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

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.

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 Nullsig » Tue Jun 05, 2012 8:35 am

So what is going wrong?

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

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.

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 Nullsig » Tue Jun 05, 2012 11:23 am

You could use your function to define Parent, Child, and (if necessary) Grandchild

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

Re: Current Page

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

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

thanks


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron