Problem with basenames in menu template

Hi everyone,

I’m haven’t been working very long with php yet - so I am having a little problem with a code I was trying to create. I have used the code before for other websites, but I didnt have pages that had been included and were called “index.php?page=…” and so on…

I was hoping someone could help me.

Heres my Code that I have so far:
[php]<?php
$home =“myButtons”;
$vita =“myButtons”;
$galerien =“myButtons”;
$referenzen =“myButtons”;
$feedback =“myButtons”;

$naviLinkid = basename($_SERVER[‘PHP_SELF’],".php");
if ($naviLinkid == “index”) {
$home = ‘myActiveButtons’;
} else if ($naviLinkid == “?page=home”) {
$home = ‘myActiveButtons’;
} else if ($naviLinkid == “?page=vita”) {
$vita = ‘myActiveButtons’;
} else if ($naviLinkid == “?page=galerien”) {
$galerien = ‘myActiveButtons’;
} else if ($naviLinkid == “?page=referenzen”) {
$referenzen = ‘myActiveButtons’;
} else if ($naviLinkid == “?page=feedback”) {
$feedback = ‘myActiveButtons’;
}
?>
[/php]

And after the php-code (in the same document) I have the following for my Navigation:

<a class="<?php echo $home; ?>" href="index.php?page=home">Home</a> <a class="<?php echo $vita; ?>" href="index.php?page=vita">Vita</a> <a class="<?php echo $galerien; ?>" href="index.php?page=galerien">Galerien</a> <a class="<?php echo $referenzen; ?>" href="index.php?page=referenzen">Referenzen</a> <a class="<?php echo $feedback; ?>" href="index.php?page=feedback">G&auml;stebuch</a>

And here you can look at the page I need it for: tierisch-in-design.de/pws/ (sorry, links dont seem to work?)
I just started working on it and got pretty much nothing done because I have been working on the navigation the past few hours… -.-

If you look at the page (I’m gonna leave the navigation as it is until maybe someone can help me) you can already see what I want when you look at the “Home”-page. The little triangel at the top and then the the “Home” in green… It works alright on the “Home”-page, but once I try any of the other pages, it still stays on the “Home” of the navigation, even though the page itself changes.

I am pretty sure that the "?page=…"s are the problems here and also that the pages all start the same (and probably the index)… But I need to use the include funktion on my main page and I can not figure out how to make it work. I have tried several ways but it just wont work.

I really hope you guys can help me (soon), since this is a little project (just for fun) for a friend and she needs it really badly by the end of May…

Many thanks in advance!

Thanks to a friend the Problem is solved. (:

I had

[php]$page = $_GET[‘page’];[/php]

in the document I was including the document (from the post above) in so I just used $page instead of the naviLinkid and basename etc. (:

Sponsor our Newsletter | Privacy Policy | Terms of Service