Return to Snippet

Revision: 8433
at September 20, 2008 23:09 by davidsword


Initial Code
<?php
//page titles / page number
$titles = array(
	'Page Number 1' => '01', 
	'Page Number 2' => '02', 
	'Page Number 3' => '03'
); 
//get current page
$page = (!empty($_GET['page'])) ? $_GET['page'] : null; 
//write pages
foreach($titles as $v => $k) { 
	$h = ($k == $page) ? " style='background:yellow;'" : '';
	echo "<a href='?page=$k'$h>$v</a><br />\n";
} 

// If page is '?page=02', will print...
// 
// <a href='?page=01'>Page Number 1</a>
// <a href='?page=02' style='background:yellow;'>Page Number 2</a>
// <a href='?page=03'>Page Number 3</a>
?>

Initial URL
http://davidsword.ca/

Initial Description

                                

Initial Title
Highlight current page in navigation

Initial Tags
page

Initial Language
PHP