Return to Snippet

Revision: 2833
at April 25, 2007 08:59 by 1man


Initial Code
//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');
?>

Initial URL
http://alistapart.com/articles/keepingcurrent/

Initial Description
Very simple navigation. Style the id using CSS. Allows you to highlight the current page with CSS.

Initial Title
Simple PHP Navigation

Initial Tags
css, php, style, navigation

Initial Language
PHP