I have a situation here. In my project the menu section contains some anchor tags, it will work perfectly when we in index page, but moving to other pages i want to give the real links there, so my question is how to check which page is viewing or how to check the the site viewer is not in index page
<li><a href="#home" class="active">Home</a></li>
<li><a href="#about_us">About Us</a></li>
I want to change href
conditionally, for example when I'm in index the above href
attribute is OK, and when I'm in another page, for example register, then the href
attribute change to index.php/site/index#home
Thanks in advance
UPDATE : thank you uttara,I found a solution with the help of her
<?php
$url = $_SERVER["REQUEST_URI"];
$page = pathinfo($url);
$filename = $page['filename'];
$href = ($filename=='root_directory' || $filename=='index' || $filename=='site')?'':Yii::app()->request->baseUrl;
?>
<a href="<?php echo $href ; ?>#home" class="active">Home</a>