Tag Archives: Condition statements

Conditional statements for url in XenForo templates

[gard]
If  you need to check a conditional statement in your XenForo template for a specific part of a url just use the following syntax:

<li id="menu-item-14" class="<xen:if is="{$requestPaths.requestUri} == '/community/marketplace/categories/marketplace.7/'"> current-menu-item</xen:if>"><a href="http://www.xsimulator.net/community/marketplace/categories/marketplace.7/">Marketplace</a></li>

In this example, if the current Url is

'/community/marketplace/categories/marketplace.7/'

the class will be extended with

current-menu-item

I use that piece of code to get the current page link in in the main navigation of the XSimulator forum.
[gard]