Hi, all I have several small problems and if you people here could give me any help with any of them, that would be great.
I still consider myself a PHP n00b, so please bear with me.
(1) I'm making a web site for a client of mine here. And notice how the stylesheet has the word "About Us" highlighted? Well PHP tells the stylesheet to do that if the user is in that section of the site, based upon string matching. But if you click on another menu item, such as "nursing homes", or "news"... they also highlight, but only ONE is supposed to be highlighted at a time.
I'm using stristr() to check if the URL matches a string in my array. However the main index page is "index.php" and since several of the sub pages are "index.php" as well, it highlights two of them! :o
Here's some of my PHP code:
<?php
$url = $_SERVER['PHP_SELF'];
$c = 0;
$num = 1; $num2 = 1;
/* the main topics accross the top */
$navigation = array(
"nav" => array('/index.php','/nursinghome/','/pressroom/','/events/','/services/','/joinacc/','/partners/'),
"link" => array('About Us','Nursing Homes','News','Calendar','Services','Join Us','Volunteer'),
);
/* begin nav */
foreach($navigation['nav'] as $val) {
echo "";
if (stristr($url, $val)) {
echo "<a href='". $val ."' id='gl". $num++ ."' class='active' onmouseover='ehandler(event,menuitem". $num2++ .");'>" . $navigation["link"][$c++] . "</a>\n";
} else {
echo "<a href='". $val ."' id='gl". $num++ ."' onmouseover='ehandler(event,menuitem". $num2++ .");'>" . $navigation["link"][$c++] . "</a>\n";
}
}
/* end nav */
?>
(2) Addtionally, my clients host has some rather strange PHP settings. They are running PHP as CGI, and I sometimes get this "No input file specified." error... Look here.
I have a ErrorDocument set inside my .htaccess file to bring up my /page404.php file but it only works SOMETIMES. So I'm not exactly sure if there is anything I can do on my end to fix this.
Thanks in advance.