List of if conditions

jgas

Active member
Hi,
could you please write a list of all the conditions we can use on xenforo?

Mainly, i need the conditions is registred, is unregistred, is thread x, is forum y, is usegroup z!

Thanks! ;)
 
Mainly, i need the conditions is registred, is unregistred, is thread x, is forum y, is usegroup z!

Registered and unregistered:

http://xenforo.com/community/threads/1-0-0-b1-member-guest-template-condition.5566/

Group checking:

http://xenforo.com/community/threads/usergroup-checking-in-the-templates.9447/

Threadid checking (works in the thread_view template):

Code:
<xen:if is="{$thread.thread_id} == 1">
	test
</xen:if>

Forumid checking (works in forum_view):

Code:
<xen:if is="{$forum.node_id} == 2">
	test
</xen:if>
 
Wondering how to "NOT" display things in certain forums...

I know how to do that, but the thing is how do I use it in page container? Since I've heard that you can only use it in "forum_view".

By the way I am talking about this condition...

<xen:if is="{$forum.node_id} == 2"> test </xen:if>

So here is the deal, I need to display ads globally, but I do not want to display them in certain forums, since they would most likely violate the ad's TOS, thats why I am trying to use template conditions so they are not displayed on these pages.

So if Anyone has an idea of how to do this please let me know. Again I need to use this in Page_Container, and in thread_view I think.
 
Wondering how to "NOT" display things in certain forums...

I know how to do that, but the thing is how do I use it in page container? Since I've heard that you can only use it in "forum_view".

By the way I am talking about this condition...

<xen:if is="{$forum.node_id} == 2"> test </xen:if>

So here is the deal, I need to display ads globally, but I do not want to display them in certain forums, since they would most likely violate the ad's TOS, thats why I am trying to use template conditions so they are not displayed on these pages.

So if Anyone has an idea of how to do this please let me know. Again I need to use this in Page_Container, and in thread_view I think.

See this post:

http://xenforo.com/community/threads/language-attribute.15249/#post-200171

The instructions are the same for you, except at the end when you edit PAGE_CONTAINER. Use this code:

Rich (BB code):
<xen:if is="!in_array({$forumId}, array(1,2,3))">
	AD CODE HERE
</xen:if>

This condition will make it so the ad code does not display in forums 1, 2, and 3. Specify the node_ids of your excluded forums.
 
See this post:

http://xenforo.com/community/threads/language-attribute.15249/#post-200171

The instructions are the same for you, except at the end when you edit PAGE_CONTAINER. Use this code:

Rich (BB code):
<xen:if is="!in_array({$forumId}, array(1,2,3))">
AD CODE HERE
</xen:if>

This condition will make it so the ad code does not display in forums 1, 2, and 3. Specify the node_ids of your excluded forums.

That is perfect, its working for me, just another question how would you be able to do this with categories.

Also, the threads within these forums are still displaying the ads,...

How do you make it so the threads within the forums that I do not want ads displayed do not display ads as well.
 
That is perfect, its working for me, just another question how would you be able to do this with categories.

When you edit forum_view and thread_view, use this code instead to pass the parent_node_id:

Code:
<xen:container var="$forumId">{$forum.parent_node_id}</xen:container>

Now you can specify the immediate parent_node_id in PAGE_CONTAINER. 1,2,3 would then specify the node_ids of the categories you want to exclude. All forums that are immediate children of the parent_node_id will be excluded from showing ads.

Also, the threads within these forums are still displaying the ads,...

How do you make it so the threads within the forums that I do not want ads displayed do not display ads as well.

Make sure you edited both forum_view and thread_view, per that post:

http://xenforo.com/community/threads/language-attribute.15249/#post-200171
 
When you edit forum_view and thread_view, use this code instead to pass the parent_node_id:

Code:
<xen:container var="$forumId">{$forum.parent_node_id}</xen:container>

Make sure you edited both forum_view and thread_view, per that post:

http://xenforo.com/community/threads/language-attribute.15249/#post-200171

As for this

Code:
<xen:container var="$forumId">{$forum.parent_node_id}</xen:container>

I didn't really need the parent part, so I took that out and its working with categories now.

I just used this ..

Code:
<xen:container var="$forumId">{$forum.node_id}</xen:container>

As for the thread_view and forum_view thats working great now thanks.

Just another question, I also have ads displaying in threads, right after the first message.

This is in the "message" template, and I pretty much want to exclude it from some of the forums that violate the AD tos, pretty much what we did with Page_Container, I just tried the same thing that I did with page_contrainer, and it didn't work. So if you could please help me with that part as well.

Thank you so much for the help by the way.
 
Just another question, I also have ads displaying in threads, right after the first message.

This is in the "message" template, and I pretty much want to exclude it from some of the forums that violate the AD tos, pretty much what we did with Page_Container, I just tried the same thing that I did with page_contrainer, and it didn't work. So if you could please help me with that part as well.

In the message template you can use this condition:

Rich (BB code):
<xen:if is="!in_array({$thread.node_id}, array(1,2,3))">
	AD CODE HERE
</xen:if>
 
Why would you want to hide a category? Do you mean it's individual category row, but still show the forum nodes themselves? Or the particular node?
Doesn't xenforo node manager already have an option [x] display in node list?
 
Registered and unregistered:


Forumid checking (works in forum_view):

Code:
<xen:if is="{$forum.node_id} == 2">
test
</xen:if>

Jake, how can I combine that above with another conditional, so the ads only get displayed to guests only in one forum. I know the guests conditional, but I'm not sure how to combine them both into one, rather than using two separate conditionals.
 
Top Bottom