我有 header.tpl 文件要包含在我运行 Smarty 的整个网站中。当页面在浏览器中处于活动状态时,我需要一个 php-if 代码来使某些导航菜单元素采用类“当前菜单项”。
<ul>
<li class="current-menu-item"><a href="http://localhost/dbk/index.php">Home</a> </li>
<li><a href="#">Company</a>
<ul class="sub-menu">
<li><a href="http://localhost/dbk/about.php">About Company</a></li>
<li><a href="http://localhost/dbk/team.php">Excuslive Team</a></li>
<li><a href="http://localhost/dbk/global-business.php">Global Business</a></li>
<li><a href="http://localhost/dbk/contract-manufacturing.php">Contract Manufacturing</a></li>
</ul>
</li>
<li><a href="#">Our Products</a>
<ul class="sub-menu">
<li><a href="http://localhost/dbk/pharmaceutical-products.php">Pharmaceutical Products</a></li>
<li><a href="http://localhost/dbk/products/herbal-and-food.php">Herbal & Food Supplements</a></li>
<li><a href="http://localhost/dbk/products/cosmetics.php">Cosmetics</a></li>
<li><a href="http://localhost/dbk/products/veterinary-products.php">Veterinary Products</a></li>
</ul>
</li>
<li><a href="http://localhost/dbk/blog">News Room</a></li>
<li><a href="http://localhost/dbk/careers.php">Careers</a> </li>
<li><a href="http://localhost/dbk/contacts.php">Contacts</a></li>