Conditional Statements

Conditional Statements

I'm having trouble piecing together a conditional for last posts only. Currently I have this:

<xen:if is="!{xen:helper ismemberof, 25, 26} AND {$thread.last_post_id}">

But it still showing the ad in all the posts, not just the last.
 
So I put
<xen:if is="in_array({$forum.node_id}, array(138))== 0 AND {xen:helper ismemberof, $visitor, 1}"> to display something:
- in forum 138
- only to visitors

and it works fine except it is displayed on ALL PAGES of forum 138.

How is it possible to show it only on the first page of this sub forum ?
I didn't see that in the conditions you listed.

Thanks for the help
 
You should add this to the document for testing if you are in a specific page node:

<xen:if is="{$quickNavSelected} == 'node-99'">​

(and no, I didn't find this on my own, I never would have guessed at anything resmembling this :) )
 
Last edited:
How would you do this if you wanted the ad to show on every page except for the login/register page. Is that possible?
 
Hi! I already had those responsive adsense conditional statements, but I would like to avoid adds also at node pages. I already tried but they are not working.
My attempts:
adding node-391
Code:
<xen:if is="!in_array({$contentTemplate}, array('message_page', 'error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'register_facebook', 'register_twitter', 'register_google', 'login', 'error_with_login', 'contact', 'node-391'))">

adding page_node.391
Code:
<xen:if is="!in_array({$contentTemplate}, array('message_page', 'error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'register_facebook', 'register_twitter', 'register_google', 'login', 'error_with_login', 'contact', 'page_node.391'))">

adding 391
Code:
<xen:if is="!in_array({$contentTemplate}, array('message_page', 'error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'register_facebook', 'register_twitter', 'register_google', 'login', 'error_with_login', 'contact', '391'))">

etc.
What I am doing wrong?
Thanks for any help!
 
The template for page nodes is pagenode_container so that won't work.

You can use something like this instead: <xen:if is="{$quickNavSelected} != 'node-391'">
 
The template for page nodes is pagenode_container so that won't work.

You can use something like this instead: <xen:if is="{$quickNavSelected} != 'node-391'">
Yes, thanks! That worked.

Is it possible to add several nodes like:
<xen:if is="{$quickNavSelected} != 'pagenode_container'">

Or I need to add each of them like:
<xen:if is="!in_array({$quickNavSelected}, array('node-391', 'node-24'))">

Thanks a lot!
 
Hey,

<xen:if is="{$user.user_group_id} == x"> works only for the main group but doesn't triggers with the secondary group. What I have to use for it?
 
Just curious, which would be a better, more efficient conditional: Use multiple else if or nested if statement.

Code:
<xen:if is="{$visitor.user_id} AND !{xen:helper ismemberof, $visitor, x}">
-Show this to all logged in users not in Group x
<xen:elseif is="{xen:helper ismemberof, $visitor, x}" />
-Show this to users in Group x
<xen:else />
</xen:if>

OR

<xen:if is="{$visitor.user_id}">
<xen:if is="!{xen:helper ismemberof, $visitor, x}">
-Show this to all logged in users not in Group 
<xen:else />
-Show this to all logged in users in Group x
</xen:if>
</xen:if>
 
I'm trying to display content in the header of the post for every post EXCEPT the initial one of a thread. I've tried it with every example I can find, and it either displays in all, or in none of the posts. This is what I've got currently:
Code:
<xen:if is="{$postId} != 0">
   Display this stuff
</xen:if>

It's not displaying anywhere.
 
I'm trying to display content in the header of the post for every post EXCEPT the initial one of a thread. I've tried it with every example I can find, and it either displays in all, or in none of the posts. This is what I've got currently:
Code:
<xen:if is="{$postId} != 0">
   Display this stuff
</xen:if>

It's not displaying anywhere.

This works fine for me to display content in just the first post so you can try to just negate this:

Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0">
Test Content
</xen:if>
 
Back
Top Bottom