有谁知道如何检查href是否等于smarty中的当前页面链接?我想将“事件”类添加到菜单中的链接。 我的代码是这样的
<div id="navigation-menu">
<a href="index.php" class="active">Home</a>
<a href="index.php?page=how_it_works">How it Works</a>
<a href="index.php?page=prices">Prices</a>
</div>
最佳答案
认为你可以做这样的事情:
<div id="navigation-menu">
<a href="index.php"{if $smarty.get.page eq ''} class="active"{/if}>Home</a>
<a href="index.php?page=how_it_works"{if $smarty.get.page eq 'how_it_works'} class="active"{/if}>How it Works</a>
<a href="index.php?page=prices"{if $smarty.get.page eq 'prices'} class="active"{/if}>Prices</a>
</div>
但不确定,不知道聪明。
关于php - 有谁知道如何检查 href 是否等于 smarty 中的当前页面链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13685011/