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
精彩评论