Conditionals somehow don't work


Well-known member
I have this code at the very beginning in PAGE_CONTAINER:

<xen:if is="{$canSearch}">
    <xen:if is="{$controllerName} == 'XenResource_ControllerPublic_Resource'">
        <xen:if is="{$controllerAction} == 'Index'">
            <xen:set var="$hasSearchBar" value="true" />
        <xen:elseif is="{$controllerAction} != 'Index'" />
            <xen:set var="$hasSearchBar" value="false" />
    <xen:else />
        <xen:set var="$hasSearchBar" value="true" />
It checks if there should be a serachBar, obviously. But it doesn't work as expected. I always have searchBar even when {$controllerAction} != 'Index'.
What can be causing that? I just tried everything and it doesn't work. I have $hasSearchBar variable in breadcrumb template and it seems to be working but in a wrong way, it always gives 'false'.


XenForo developer
Staff member
The values you are setting are strings - not booleans. You'll need your $hasSearchBar check to respect that.