Conditionals somehow don't work

CyberAP

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

Code:
<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:if>
    <xen:else />
        <xen:set var="$hasSearchBar" value="true" />
    </xen:if>
</xen:if>

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'.
 
The values you are setting are strings - not booleans. You'll need your $hasSearchBar check to respect that.
 
Back
Top Bottom