Conditional Statements

Conditional Statements

Hello @Brogan
thanks for this useful resource :)
I'm not developer, I have a basic knowledge of Php code ( Html and CSS ok)
I would modify one addon that i'm using: this addon shows images inserted in latest threads opened.
I would shows images inserted in latest threads opened only from users that user-logged is following. ( example: user-logged X is following users Y,Z,W and the addon will shows only images in thread started by users Y,Z,W)
Can i use conditional statements?
Thanks
Antonio
 
I always thought that by adding ! i would achieve the opposite but it doesnt' work with this one:

24. How can I show content on a specific page?
<xen:if is="{$contentTemplate} == 'xyz'">
This content will show on the xyz template
</xen:if>


I'd like to hide some content on template x but show it everywhere else. So basiically How can I hide content on a specific page?
 
Perhaps I missed it, but how do I target a mobile user with an if statement?

Like... <xen:if is="user is on mobile" and forum.id="2222">
blah
</xen:if>
 
So if I wanted to target a template called Test1 and forum ID 7839, would this be correct?

<xen:if is="{$forumId} == 7839" and "{$contentTemplate} =='Test1' ">


Edit: I'm looking to target a Style (ie: Default Style or another style called "Test1"), as well as specific forums. I apologize as I'm a novice.
 
Last edited:
which conditional would be best to show content only on threads themselves ?

would it just be ?

Code:
<xen:if is="{$thread.thread_id}">
....
</xen:if>
or
Code:
<xen:if is="{$contentTemplate} == 'thread_view'">
This content will show on the thread_view template
</xen:if>
I want to add a link header to Page container template which only shows up on threads pages
 
which conditional would be best to show content only on threads themselves ?

would it just be ?

Code:
<xen:if is="{$thread.thread_id}">
....
</xen:if>
or
Code:
<xen:if is="{$contentTemplate} == 'thread_view'">
This content will show on the thread_view template
</xen:if>
I want to add a link header to Page container template which only shows up on threads pages
This is a block that I use to show a 'banner' specific to a thread of mine.

Code:
<xen:h1>
<xen:if is="{$thread.thread_id} == 82">
   <a href="{xen:link threads, $thread}"><img src="@imagePath/uix_dark/guns.png" alt="{$thread.title}" /></a>
<xen:else />
   {xen:helper threadPrefix, $thread}{$thread.title}
</xen:if>
</xen:h1>

That is for a specific thread and you might be wanting to do global.
 
So I want to place some content after the bottom breadcrumb but only if it is a thread and nowhere else. So will I place the content in ad_below_bottom_breadcrumb template and within the following conditions?

<xen:if is="{$forum.node_id} != x">
</xen:if>

Edit - seems this is the one

<xen:if is="{$contentTemplate} == 'thread_view'">
This content will show on the thread_view template
</xen:if>
 
Last edited:
Sorry in advance, I'm sure I am missing something simple @Brogan.
I have the create pages for categories selected, and I added the line to the top of the category_view template. I am trying to use this conditional to exclude two categories from an ad_template but no luck.
Code:
<xen:if is="{$category.node_id} != 178 AND {$category.node_id} != 179">
 
Top Bottom