我從所有文件中刪除了導航部分,並保存在一個單獨的文件名爲nav.php,然後把它稱爲在需要的地方作爲如何使導航項目處於選定狀態?
include ('includes/nav.php');
的nav.php文件的內容如下: :
<ul>
<li<?php if ($thisPage=="http://www.finalyearondesk.com")
echo " class=\"selected\""; ?>>
<a href="http://www.finalyearondesk.com">Home</a></li>
<li<?php if ($thisPage=="http://www.finalyearondesk.com/contact.php")
echo " class=\"selected\""; ?>>
<a href="http://www.finalyearondesk.com/contact.php">Contact US</a></li>
<li<?php if ($thisPage=="http://www.finalyearondesk.com/downloads.php")
echo " class=\"selected\""; ?>>
<a href="http://www.finalyearondesk.com/downloads.php">Downloads</a></li>
</ul>
但問題是,我無法獲得該頁面訪問時選擇的當前項目。 我的代碼有什麼問題?
var $ thisPage等於什麼? – 2011-12-24 07:19:39
我有三個頁面需要顯示。 – 2011-12-24 07:20:49