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

Conditionals wrapped in conditionals

Discussion in 'XenForo Questions and Support' started by ibenick, Mar 11, 2013.

  1. ibenick

    ibenick Active Member

    I've searched for an answer on this and I can't find the information I need.

    I have ads at the top of each thread on my site that only show to guests. I need to make it so that in one specific thread, that ad does not appear for anyone at all.

    So I looked at this from the FAQ:

    And figured I could do this:

    <xen:if is="{$threadId} == 1923">
    <p>This content goes in thread 1923</p>
    <xen:else />
    <div>ad code</div>
    That didn't work though. Any ideas why? And then even if I go get it working, can I then wrap all that up in another conditional that says only show that to guests? Sorry if this has been covered elsewhere.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Which template are you using that in?

    Did you make note of the section on container variables in the FAQ?

    Similarly for the $threadId variable, you would add this: <xen:container var="$threadId">{$thread.thread_id}</xen:container>.

    So you need to add that to the top of the PAGE_CONTAINER template.
  3. ibenick

    ibenick Active Member

    Thanks, Brogan. I'm having a bit of trouble understanding what I need to do.

    I had originally tried just putting that code in using the Rotating Ads add-on. That didn't work so I tried adding it to the 'ad_thread_view_above_messages' template which also didn't work.

    On the container thing, that's where I really don't follow. I'm reading this from the FAQ:

    Do I just put that code I had before inside of this then? Do I replace the "{$thread.thread_id}" with my if/else?

    <xen:container var="$threadId">{$thread.thread_id}</xen:container>
    And would I not put that into my 'ad_thread_view_above_messages' template rather than the PAGE_CONTAINER?

    I'm sorry I'm not following...
  4. Brogan

    Brogan XenForo Moderator Staff Member

Share This Page