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

New Discussion Button - If Statement

Discussion in 'XenForo Questions and Support' started by Sole Trader Forum, Aug 21, 2012.

  1. Sole Trader Forum

    Sole Trader Forum New Member

    Hi,

    Apologies I'm doing something stupid here, but I'm a complete newbie to Xenforo. I'm basically trying to apply different phrases to the new post button depending on the forum ID (I have a trading forum so would like the New Thread Button to be renamed 'Sell an Item' for example.).

    The code I'm trying to use is:

    Code:
    <xen:set var="$newDiscussionButton"><a href="{xen:link 'forums/create-thread', $forum}" class="callToAction">
            <span>
            <xen:if is="{$forumId} == 19">
            Sell an Item
            <xen:else />
            {xen:phrase post_new_thread}
            </xen:if>
            </span></a>
            </xen:set>
    but it doesn't seem to want to work, is there something I'm doing wrong, and does anybody have advice on how I can get this to work?

    Thanks very much!
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Code:
    <a href="{xen:link 'forums/create-thread', $forum}" class="callToAction">
    
    <xen:if is="{$forum.node_id} == 19"> ​
    <span>Sell an Item</span>​
    <xen:else />​
    <span>{xen:phrase post_new_thread}</span>​
    </xen:if>​
    </a>
    The above works. Not sure what you're doing with the <xen:set var stuff though? It shouldn't be required for this particular requirement.
     
    Sole Trader Forum likes this.
  3. ragtek

    ragtek Guest

    it's the command to save the content into $newDiscussionButton which is used to output the button^^
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    Ah yes, you're right.

    Nonetheless, my example will work within the <xen:set var tags.
     
  5. Sole Trader Forum

    Sole Trader Forum New Member

    Thanks very much, that works perfectly. I'll probably be using this statement a fair bit, so it's extremely helpful!

    Thanks again fro your help.
     
    Chris D likes this.

Share This Page