Hello all,
I just took over a custom CMS which was built by a former employee at my company. The entire CMS is PHP Driven and never leaves index.php. There are simple IF Statements that tell it to pull content out of the database via it’s ID.
The problem here is that I cannot figure out how to make the navigation stay active on the current page, because you never leave index.php.
For example,
The homepage is: index.php
The about page is: index.php?id=26
The careers page is: index.php?id=28
Any idea on how I can pull this off? I figure an onClick or something, but I suck at Javascript, my main strength is PHP and I cannot find a way to do this in PHP.
Here is the code on how the navigation is created. It is setup to be dynamic, so if you create a page in the custom CMS, it’ll populate automatically.
<div id="nav-bar">
<ul class="main-nav">
<li><a href="index.php">Home</a></li>
<?
$query=mysql_query("SELECT * from section");
while($row=mysql_fetch_assoc($query)){
?>
<li><a href="index.php?id=<? echo $row['id']; ?>">
<? echo $row['section']; ?></a></li>
<? } } ?>
<li><a href="index.php?id=projects">Projects</a></li>
<li><a href="index.php?id=news">News</a></li>
</ul>
</div>
Any help is greatly appreciated, the deadline for the project is Friday!