Hi guys, Been trying to use the follow for the navigation menu, which is in header.php. <li><a href="/" <?php if ($home==true) echo 'class="active"'?>><span>home</span></a></li> Code (markup): and then on the corresponding page (i.e. index.php in this case) I'm using: <?php $home="true"; include("header.php");?> Code (markup): I know it's not the best way of doing it as it's not working! By the way I am a newbie so please don't laugh! Thanks in advance.
Why not just have a file called "header.php" and have everything for the navigation menu in that file, then on "index.php" just do: <?php if($home) include('header.php');?> PHP:
You need to add the class in the span tag see the right tag below: <li><a href="/" <?php if ($home==true) echo '<span class="active">'?>>home</span></a></li>