/ Published in: PHP
Very simple navigation. Style the id using CSS. Allows you to highlight the current page with CSS.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Place this in an include <ul> <li><a href="../index.php" <?php if($thisPage == 'home') echo 'id="here"';?> >Home</a></li> <li><a href="../page1/index.php" <?php if($thisPage == 'page1') echo 'id="here"';?> >Page 1</a></li> <li><a href="../page2/index.php" <?php if($thisPage == 'page2') echo 'id="here"';?> >Page 2</a></li> <li><a href="../page3/index.php" <?php if($thisPage == 'page3') echo 'id="here"';?> >Page 3</a></li> </ul> //This php goes inside each page, notice the variable <?php $thisPage = 'home'; include('includes/navigation.inc.php'); ?>
URL: http://alistapart.com/articles/keepingcurrent/