Conditional Statements

Conditional Statements

Either I'm losing it or I'm just not with it today. Why can't I get this to work...

Code:
<xen:if is="!{$contentTemplate} =='myTemplate'">
Stuff
</xen:if>
 
Using ad_message_body template, How can I show content only on 1st post and only on 1st page of thread?
Thanks!
 
How can I show content on a specific page?
<xen:if is="{$contentTemplate} == 'xyz'">
This content will show on the xyz template
</xen:if>
Hello,

How can I show content on a more than one specific page (template)? Let say, thread_view, forum_view and category_view.
 
Code:
<xen:if is="in_array({$contentTemplate}, array('thread_view', 'forum_view', 'category_view'))">
Content Here...
</xen:if>
ΟΚ... Can this work together with !{$visitor.user_id}? I've tried in many ways but it didn't work.

Thanks.
 
This is such a wonderful resource. The examples are incredibly helpful for noobs like me who get freaked out by the syntax of the template language.

I wonder if you might consider adding some examples based on {xen:date $serverTime, XXXX}:
http://xenforo.com/community/threads/syntax-to-output-the-day-of-the-month.78231/#post-792719

For example, we have weekly events on Tuesdays from 9-10 and Saturdays from 3-4 and would like templates to display slightly different content then. (Specifically, we'd like the TaigaChat shoutbox to appear during those times to support interactive discussion that is integrated with the forum.)
 
Last edited:
True, I was thinking of something like
Code:
<xen:if is="{xen:date $serverTime, 'D'} == 'Sat'">
This content will show on Saturdays
</xen:if>

In my case I'd like something that would show up on Saturdays between 3 and 4. With some help from your tutorial and @Chris D, I think I've figured out that the following will work if I make corrections for time zones.
Code:
<xen:if is="{xen:date $serverTime, 'D'} == 'Sat' AND {xen:date $serverTime, 'G'} == '3'">
This content will show between 3 and 4 on Saturdays
</xen:if>
 
That's not a conditional statement.
True, I was thinking of something like
Code:
<xen:if is="{xen:date $serverTime, 'D'} == 'Sat'">
This content will show on Saturdays
</xen:if>

In my case I'd like something that would show up on Saturdays between 3 and 4. With some help from your tutorial and @Chris D, I think I've figured out that the following will work if I make corrections for time zones.
Code:
<xen:if is="{xen:date $serverTime, 'D'} == 'Sat' AND {xen:date $serverTime, 'G'} == '3'">
This content will show between 3 and 4 on Saturdays
</xen:if>


is it possible to hours, during business hours for example ?
 
Hi @Brogan,

What would be a conditional I could use to display some content anywhere within the First post of a thread on the first page, rather than after the first post?

Thanks,
 
I've tried this condition but i see an error (condition not valid):
Code:
<xen:hook name="ad_message_below" />

<xen:if is="({$post.position} % {$xenOptions.messagesPerPage} == 0 OR {$post.position} % {$xenOptions.messagesPerPage} == {$xenOptions.messagesPerPage} - 1) AND !{$visitor.user_id}  == x AND !in_array({$thread.node_id}, array(25))">

How i can fix it?
 
Which variable should I use for my condition?

Code:
<xen:if is="{$variable}">
    <p>Text indicating that no staff is present in the conversation.</p>
<xen:else />
    <p>Text advising that staff is present in the conversation.</p>
</xen:if>

Knowing that I want a message that appears in conversations when a staff member is in

and that when there is no staff it displays (No staff is present in the conversation.)


I hope I was clear I can give more info :)

@Brogan help ? :(
 
Last edited:
Top Bottom