我在弄清楚这一点时遇到了一点问题:
function myMenu() //Creates a menu with a class current to the current page item
{
$menuItems = array (
"Strona Głowna" => "index.php",
"O nas" => "o-nas.php",
"Oferta" => "oferta.php",
"Polecane kierunki" => "polecane-kierunki.php",
"kontakt" => "kontakt.php",
);
foreach($menuItems as $name => $url) {
$class = 'default';
$index = 'index.php';
if ((curPageName() == $url) && (curPageName() !== $index)) {
$class='current';
}
echo "<li><a href='$url' class='$class'>$name</a></li>";
elseif (curPageName() == $index) {
$class='current home';
}
echo "<li><a href='$url' class='$class'>$name</a></li>";
};
};
基本上我只想将“当前家”分配给 index.php。也许您可以提供更好的解决方案,我是这方面的新手。无论如何,这给了我:
PHP Parse error: syntax error, unexpected T_ELSEIF in ...
任何帮助解决这个问题表示赞赏!
亚历克斯