1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Conditionals somehow don't work

Discussion in 'XenForo Development Discussions' started by CyberAP, Aug 31, 2013.

  1. CyberAP

    CyberAP 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'.
  2. Mike

    Mike XenForo Developer Staff Member

    The values you are setting are strings - not booleans. You'll need your $hasSearchBar check to respect that.
    CyberAP likes this.
  3. CyberAP

    CyberAP Well-Known Member


Share This Page