Page 1 of 1
Question: php include + id current
Posted: Tue Jan 03, 2006 5:53 pm
by C_Calav
hi Guys,
i am using a php include for a menu across about 20 pages.
is there a way i can still use the php include and be able to show some how what page they are on?
in the past i have used css and id=current but that was with the menu hard coded on everypage.
thanks guys
Posted: Tue Jan 03, 2006 5:58 pm
by Charles256
if you're doing index.php?page=currentpage. simply go
Code: Select all
$page=$_GET['page'];
switch ($page)
{
case"main":
echo "Home page";
break;
}
something like that?

Posted: Tue Jan 03, 2006 6:33 pm
by C_Calav
Thanks for the reply!
hmmm.. can you explain please a little more please?
im not sure im getting what your saying, my bad

Posted: Tue Jan 03, 2006 6:37 pm
by Charles256
are you wanting to display what page a user is on to them? or store it in a database? appearantly I mis-understood you...
Posted: Tue Jan 03, 2006 6:46 pm
by C_Calav
at the moment my navigation.php is just all <li> list elements. i want to add id=current (css) to the page they are on so if you look at the navigation being displayed it will show that link in the navagtion in a different colour.
but to do that i would have to hard code the navagation into every page and on each different page add id=current to a <li>
was wondering if there is a way i can keep my php include navagation.php and still have this effect.
sorry if i am not making sense. does this help?
Posted: Tue Jan 03, 2006 6:56 pm
by Charles256
eh.post two of your pages..lemme see..
Posted: Tue Jan 03, 2006 7:09 pm
by C_Calav
i think i have got it now.
Code: Select all
if ($pageis=="home")
{
print('<li id=\"current\">Home</li>');
}
else
{
print('<li>home</li>');
}
something like this in my navagation.php?
Posted: Tue Jan 03, 2006 7:09 pm
by Charles256
need to use a switch case so you don't have to do a bunch of if statements

Posted: Tue Jan 03, 2006 7:29 pm
by C_Calav
yes! thanks for that.. i proberly would have had 'if' statements for africa..
thanks for your help