Hi, I am developing a dynamic website and i want to highlight the current page but i'm having some trouble in applying the styles to the links. Here is what i've got so far:
<?php
function checkPage($fPage)
{
$fCurrent = $_GET['title'];
if($fPage = $fCurrent)
{
$fStyle = 'class="activelink"';
return $fstyle;
}
}
?>
//Navigation Code
<?php do { ?>
<div class="nav"><a <?php checkpage($row_nav_links['page_title'])?> href="index2.php?page=<?php echo $row_nav_links['id']; ?>&title=<?php echo $row_nav_links['page_title']; ?>"><?php echo $row_nav_links['link_text']; ?></a></div>
<?php } while ($row_nav_links = mysql_fetch_assoc($nav_links)); ?>
i got the code from a website and i'm obviously missing something but i'm new to php and cant find out why. I was also going to add an else statement to the function as i also need to apply an inactivelink class to the remaining links.
Any help is appreciated.