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

xen:if is this template..display this template

Discussion in 'XenForo Development Discussions' started by EQnoble, Jun 9, 2011.

  1. EQnoble

    EQnoble Well-Known Member

    I was wondering if there is a simple way to specify a scenario such as this below...I am sure I wrote this all sort's of wrong but that's why I am asking.

    <div class="{xen:if "{$templateName} == 'account_signature' then display template_Y

    Anyone have any ideas?
    If I would have to add this kind of functionality into a listener I am not against that at all either.
     
  2. EQnoble

    EQnoble Well-Known Member

    Figured it out....
    Code:
    <xen:if is="{$selectedKey} == 'account/signature'">
    
        <div class=>Some content</div>
    
    </xen:if>
    I should add that this does not do what I thought I was going to have to do...but I have gotten the same effect out of this that I was looking for.
     
  3. Kier

    Kier XenForo Developer Staff Member

    Maybe I'm reading it wrong, but there seems to be two questions here, so I'll answer both and see if we get to the resolution:
    Q1:
    HTML:
    <div class="{xen:if '{$templateName} == "account_signature"', 'sigClass', 'otherClass'}">
    Q2:
    HTML:
    <xen:if is="{$selectedKey} == 'account/signature'">
    	<xen:include template="my_account_signature_extra_template" />
    </xen:if>
     
    EQnoble likes this.
  4. EQnoble

    EQnoble Well-Known Member

    Well the problem with Q2 is that I am creating the template from a listener which listens for account_wrapper_content so the content in Q2 is actually already being called.

    Also I am a little confused about the 'sigClass', 'otherClass' part

    Can I use xen:if conditionals inside of my listener?
     
  5. Kier

    Kier XenForo Developer Staff Member

    Generally speaking, {$varname} in a template is equivalent to $params = $template->getParams(); $varname = $params['varname'] in your template listener.
     
    EQnoble likes this.
  6. EQnoble

    EQnoble Well-Known Member

    I think I can wrap my head around that now...thanks!

    Q2 also has given me another idea :)
     

Share This Page