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

Condition: if is in specific hook

Discussion in 'XenForo Questions and Support' started by CyberAP, Apr 21, 2012.

  1. CyberAP

    CyberAP Well-Known Member

    I want to check inside template 'breadcrumb' that it currently shown at the top. For example I need something like this:
    <xen:if hook="page_container_breadcrumb_top">My code</xen:if>

    Is it possible to do in templates?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. CyberAP

    CyberAP Well-Known Member

    Thanks! But could this be done without creating an addon?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Template changes can be applied directly by editing the templates. But to use a template hook requires a listener.
     
  5. CyberAP

    CyberAP Well-Known Member

    I mean I want to check inside template that it is currently used in specific hook. We have breadcrumbs at the top and at the bottom, but I want my code to show up only in the top breadcrumb, that means I need to check somehow that the template 'breadcrumb' is used by hook 'page_container_breadcrumb_top' at the moment.
     
  6. guiltar

    guiltar Well-Known Member

    Container params can be different since hook is separate render flow.
    Check for template name, view name, etc ..
     
  7. infis

    infis Well-Known Member

    It's more simple. Need check variable $microdata in template "breadcrumb":
    Code:
                            <xen:hook name="page_container_breadcrumb_top">
                            <div class="breadBoxTop">
                                <xen:if is="{$topctrl}"><div class="topCtrl">{xen:raw $topctrl}</div></xen:if>
                                <xen:include template="breadcrumb"><xen:set var="$microdata">1</xen:set></xen:include>
                            </div>
                            </xen:hook>
    
    Inititalized variable - top. Not - bottom.
     
    CyberAP likes this.
  8. CyberAP

    CyberAP Well-Known Member

    Thanks, that helped!
     

Share This Page