开发者

Detect page filename through javascript/php?

开发者 https://www.devze.com 2023-02-04 01:41 出处:网络
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:

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

精彩评论

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