Full-service Internet Marketing & Web Development
Recent Posts

Sponsors
![]() |
Smart Navigation BarCode Wizard, 12-30-2006 |
This script inserts a different version of a nav bar for each page based on the variable that is inserted at the top of the page. This is helpful if you want to use a single include file that calls a nav bar with links to all other pages except the current one.
See this script in action at http://krook.net/thesis.php where it creates the nav bar for the various chapters of my thesis.
-----------The PHP include, "nav.php"------------------------
<!--
Krook.net, PHP Exploits Division, 2000
Gank and improve at will.
This script pulls the correct nav bar based on the variable
embedded in the head of the "thesis.php" page.
See it in action at http://krook.net/thesis.php
-->
<tr>
<td colspan=3 align=center>
<table border=0 width=500 cellspacing=0>
<tr align=center>
<td>
<? if($page == "thesis")
{print("Intro");}
else
{print("<a href=thesis.php>Intro</a>");}
?>
</td>
<td>
<? if($page == "chapter1")
{print("Chapter 1");}
else
{print("<a href=chapter1.php>Chapter 1</a>");}
?>
</td>
<td>
<!-- and so on -->
</td>
</tr>
</table>
</td>
</tr>
-----------The PHP/HTML file that calls it, "thesis.php"---------
<!--
Defines what the page is in a variable.
Other variables for this example are "chapter1,"
"chapter2," "chapter3," "chapter4," "bibref."
-->
<?
$page = "thesis";
?>
<html>
<head>
<title>Title</title>
</head>
<body>
<table border="0">
<tr>
<td width="5%"><img src="left_image.gif"></td>
<td width="90%" align="center"><img src="center_image.gif"></td>
<td width="5%"><img src="right_image.gif"></td>
</tr>
<tr>
<td colspan="3" bgcolor="#000000"><img src="pixel.gif" height="1" width="1"></td>
</tr>
<!-- Nav Menu Call-->
<?
include ("nav.php");
?>
<!-- End Nav -->
<tr>
<td colspan="3" bgcolor="#000000"><img src="pixel.gif" height="1" width="1"></td>
</tr>
<tr>
<!-- Content is Here -->
<td>Content</td>
<!-- End Content -->
</tr>
</table>
</body>
</html>
|
|
Subscribe Now to receive new posts via Email as soon as they come out.
Comments
Post your comments

