Conditionals wrapped in conditionals

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:


How can I show content in a specific thread?
<xen:if is="{$threadId} == x">
This content will show in thread x
</xen:if>

And figured I could do this:

Code:
<xen:if is="{$threadId} == 1923">
 
<p>This content goes in thread 1923</p>
 
<xen:else />
 
<div>ad code</div>
 
</xen:if>

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.
 
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.
 
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:

When working with the PAGE_CONTAINER template, you can pass variables from the view templates (category_view, forum_view, thread_view, etc.) usingxen:container. The same applies to any templates which are included in the PAGE_CONTAINER template; the header or ad_header templates for example.
To use the $forum.node_id variable for example, you would add this to the PAGE_CONTAINER template: <xen:container var="$forumId">{$forum.node_id}</xen:container>.
Similarly for the $threadId variable, you would add this: <xen:container var="$threadId">{$thread.thread_id}</xen:container>.
Do I just put that code I had before inside of this then? Do I replace the "{$thread.thread_id}" with my if/else?

Code:
<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...
 
Back
Top Bottom