Hi -
I'm trying to set up what eventually will be a dynamic navigation bar. I'm just in test stages, so some of the code below might not make sense, but I can't seem to get beyond my problem with ereg_replace. The code in question:
<?
$navigation="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n";
$navigation.="<tr>\n<td> </td>\n</tr>\n";
$navigation.="<tr>\n<td><a href=\"navtest.php3?mainnav=Home\">Home</a></td>\n</tr>\n<tr>\n<td> </td>\n</tr>\n";
$navigation.="<tr>\n<td><a href=\"navtest.php3?mainnav=About\">About</a></td>\n</tr>\n";
$navigation.="</table>\n";
if ($mainnav=="Home"){
$navigation = ereg_replace("<tr>\n<td><a href=\"navtest.php3?mainnav=Home\">Home</a></td>\n</tr>\n<tr>\n<td> </td>\n</tr>\n", " ", $navigation);
}
if ($mainnav=="About"){
$navigation = ereg_replace("<tr>\n<td><a href=\"navtest.php3?mainnav=About\">About</a></td>\n</tr>\n", "<tr bgcolor=\"#990033\">\n<td height=\"1\"></td>\n</tr>\n<tr bgcolor=\"#CCCCCC\">\n<td><p><a href=\"navtest.php3?mainnav=About\"><b>About</b></a></p></td>\n<tr bgcolor=\"#990033\">\n<td height=\"1\"></td>\n</tr>\n", $navigation);
}
print $navigation;
?>
I've used include(navfile.php3); to add the navigation but the 'replaces' never happen when I click on the links. Any thoughts?
Thanks for your help...