I am having problems with str_replace. What I am doing for the administration pages of my CMS I have a include page for the top
navigation (nav.inc.php). So I'll show you my code.
$page = $_SERVER['SCRIPT_NAME'];
$prefix = '/administration/';
//get main and sub
$main = '<div class="main-links"><a class="wnav" href="'.$prefix.'">Home</a><a class="wnav" href="'.$prefix.'links.php">Links</a><a class="wnav" href="'.$prefix.'manage.php">Posts</a><a class="wnav" href="'.$prefix.'pages.php">Pages</a><a class="wnav" href="'.$prefix.'media.php">Media</a><a class="wnav" href="'.$prefix.'options.php">Options</a><a class="wnav" href="'.$prefix.'users.php">Users</a><a class="wnav" href="'.$prefix.'login.php?logout">Logout</a></div>';
$search = "<a class='wnav' href='".$page."'>";
$replace = "<a class='bnav' href='".$page."'>";
$main = str_replace($search, $replace, $main);
What it is doing is its a horizontal nav bar, but whatever page you are on, is the opposite color, Black.
Ideas?
Thanks