开发者

Detect page filename through javascript/php?

I am making a menu on a Wordpress template and need the menu to detect the current page and highlight it. So for instance, my menu is:

<li><a href="index.html" class="current">Home<开发者_JS百科/a></li>
<li><a href="about.html">About</a></li>

So if the user is on the About page, I want that one to have the "class=current". How is this possible? Please appreciate that my javascript/php knowledge is very limited, so kindly make any replies detailed.


You can use the php variable $_SERVER['PHP_SELF'].

See http://www.php.net/manual/en/reserved.variables.server.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜