Hi.
For some reason this code does not show the appropriate tab as current:
inc/top.inc.php
<?php
$on = ' id="current"';
$subon = ' id="subcurrent"';
$productsubnav = "<ul>
<li$ppon><a href=\"submenu1.php\">submenu1</a></li>
<li$submenu2><a href=\"submenu2.php\">submenu2</a></li>
<li$submenu3><a href=\"submenu3.php\">submenu3</a></li>
<li$submenu4><a href=\"submenu4.php\">submenu4</a></li>
<li$submenu5><a href=\"submenu5.php\">submenu5</a></li>
<li$submenu6><a href=\"submenu6.php\">submenu6</a></li>
<li$submenu7><a href=\"submenu7.php\">submenu7</a></li>
</ul>";
if ($page == 'index') {
$ion = $on;
$title = 'index';
$description = 'index';
$subnav = 'FALSE';
}
/* Start Products */
elseif
($page == 'products') {
$pon = $on;
$title = 'Products';
$description = 'Description about products';
$ppon = $subon;
$subnav = 'TRUE';
$subnavcontent = $productsubnav;
}
elseif
($page == 'menu1') {
$con = $on;
$title = 'menu1';
$description = 'Description about colour menu1';
$subnav = 'FALSE';
}
elseif
($page == 'menu2') {
$caon = $on;
$title = 'menu2';
$description = 'Description about menu2';
$subnav = 'FALSE';
}
elseif
($page == 'menu3') {
$aon = $on;
$title = 'menu3';
$description = 'Description of menu3';
$subnav = 'FALSE';
}
elseif
($page == 'menu4') {
$fon = $on;
$title = 'menu4';
$description = 'Description of menu4';
$subnav = 'FALSE';
}
elseif
($page == 'menu5') {
$coon = $on;
$title = 'menu5';
$description = 'Description of menu5';
$subnav = 'FALSE';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo $title; ?></title>
<style type="text/css" media="all">@import "inc/style.css";</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo $description ?>" />
<meta name="author" content="content" />
<meta name="copyright" content="content" />
<meta name="robots" content="index,follow" />
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"> <!-- start header -->
<table cellpadding="0" cellspacing="0" width="100%" class="top"> <tr>
<td valign="top"> <img src="inc/images/logo.jpg" alt="logo" /> </td>
</tr>
</table>
<!-- end header --> </td>
</tr>
<tr>
<td valign="top" class="navigationtable"> <!-- start navigation -->
<table cellpadding="0" cellspacing="0" width="100%"> <tr>
<td class="fadeleft"> </td>
<td id="navigation"> <ul>
<li<?=$ion;?>><a href="index.php">Home</a></li>
<li<?=$pon;?>><a href="products.php">Products</a></li>
<li<?=$con;?>><a href="menu1.php">menu1</a></li>
<li<?=$caon;?>><a href="menu2.php">menu2</a></li>
<li<?=$aon;?>><a href="menu3.php">menu3</a></li>
<li<?=$fon;?>><a href="menu4.php">menu4</a></li>
<li<?=$coon;?>><a href="menu5.php">menu5</a></li>
</ul></td>
<td class="faderight"> </td>
</tr>
</table>
<!-- end navigation --> </td>
</tr>
<?php
if ($subnav=='TRUE') { ?>
<tr>
<td valign="top" class="subnavigationtable"> <!-- start sub navigation -->
<table cellpadding="0" cellspacing="0" width="100%"> <tr>
<td class="contentfadeleft" valign="top"> </td>
<td valign="top" id="subnavigation">
<?php echo $subnavcontent; ?>
<!-- end sub navigation --></td>
</tr>
</table></td>
</tr>
<?php } ?>
<tr>
<td valign="top">
<table cellpadding="0" cellspacing="0" width="100%"> <tr>
<td class="contentfadeleft"> </td>
<td valign="top"> <!-- start content -->
products.php
<?php $page="products"; require ("inc/top.inc.php");?>
<table cellpadding="0" cellspacing="0" width="100%" class="content"> <tr>
<td valign="top"> Content <br />
<br />
<br />
<br />
<br />
<br /> </td>
</tr>
</table>
<?php require ("inc/footer.inc.php");?>
inc/footer.inc.php
<!-- end content --></td>
</tr>
</table>
</td>
</tr>
<tr><td valign="top">
<!-- start footer -->
<table cellpadding="0" cellspacing="0" width="100%" class="footer"> <tr>
<td valign="top">Footer</td></tr>
</table>
</td></tr>
</table>
</body>
</html>
Is there a better way to have current tabs, rather than defining each case?
Thank you