I am using the following to get the active page url:
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
echoing the above gives me my URL as follows:
http://www.domain-nane.com/index.php?option=com_content&view=article&id=6&Itemid=109
I want to add a class of 'current' to my 'li' if the active page is present - dependant on the 'Itemid' contained in the url - i.e.
<li class="current">
<a href="index.php?option=com_content&view=article&id=6&Itemid=109">Link 1</a>
<li>
<a href="index.php?option=com_content&view=article&id=6&Itemid=110">Link 2</a>
</li>
<li>
<a href="index.php?option=com_content&view=article&id=6&Itemid=111">Link 3</a>
</li>
Any hints/ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…