Conditional Statements

Conditional Statements

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

Shows nothing.
 
And this:

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

Shows on all posts.
 
I've tried in both the header and footer for the custom post fields (waindigo add on), so it's not on a specific template. I'm beginning to think most of the fields in the conditional are null, as far as the header/footer can tell.
 
I've tried in both the header and footer for the custom post fields (waindigo add on), so it's not on a specific template. I'm beginning to think most of the fields in the conditional are null, as far as the header/footer can tell.
Can't really test in that one since I don't have that mod but the code works fine in the default templates I tried: ad_message_body and ad_message_below
 
Yep, I just confirmed it works there, but the custompostfields don't, so that isn't a solution for me. Back to the addon post I go.
 
If I wanted to show a banner every 5th post, how would I do that?

So, since there are 20 posts a page, I want a banner on post 5, 10, 15, 20 for every page.

I tried this, but it only shows on 5th post:

Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == x">
This content will show after post x on every page
</xen:if>

I thought this might do it, but nothing shows up:

Code:
<xen:if is="in_array({$postId}, array(5, 10, 15, 20))">

Thanks in advance.

caliman
 
That got us closer. Thanks.

But rather than showing up every 5th post, it just shows on posts that are in that array. So page 2 does not have banners after the one at post 20.
 
Thanks for the lead. I am trying to find some examples of use on the board but coming up short. I'll keep digging.
 
An image would display if a user in this group is, everyone should see this.

What is the Condi?
 
Depending on what you are trying to achieve:

<xen:if is="{xen:helper ismemberof, $user, x}">
<xen:if is="{xen:helper ismemberof, $visitor, x}">
 
Is there a conditional that will show or hide something if the page is a thread? I want to display something unless its actually a thread.
 
A few questions:
Is there any way to display for a specific age or age range?
Is there a way to display content for people who have certain answers in their custom field? i.e. Do you like pizza? Yes / No (only 2 options).
Can you also display something based on just filling out a custom field?
Can you display something based on a "free form" answer for a custom field? Like: Occupation, displaying something to anyone that puts "coder" down as their occupation.

These are more questions so I can help people with allowing advertisers to target their users more specifically (hopefully raising RPM for xf admins). You can see the guide here.
 
What's the conditional for displaying content if a user is a particular userid?

EDIT: Nevermind, i figured it out on my own. Here it is for anyone interested:

Code:
<xen:if is="{$user.user_id} == #">
 
Last edited:
I have a question, i want to use the templates that hides some codes to guest (example the members online block, a chat etc.) to save resources. My question is: the queries/code will be executed when a guest visits the home or not?
 
Back
Top Bottom