Conditional Statements

Conditional Statements

There is no way of targeting a specific resource using conditional statements or CSS.

I would recommend adding the content to the resource description.
 
There is no way of targeting a specific resource using conditional statements or CSS.

I would recommend adding the content to the resource description.
Thanks for your reply @Brogan.
Just to be sure, that means I can't create sidebar content for resources in a specific resource category using either ad templates of widgets?
 
Can you target custom templates with this conditional?

<xen:if is="{$contentTemplate} == 'xyz'">
This content will show on the xyz template
</xen:if>


Doesn't seem to work for me
 
Only if the template name is the base class of the page.

For example, this template name is thread_view.

upload_2016-12-11_16-58-21.webp
 
It's not really clear how you are serving the template but I would suggest custom development is likely required.
 
I have created several page nodes, that use templates to display content.

I want to target them in the page_container to add a selected class to a custom nav bar.
 
So im trying to make a spoiler content visible to a specific user group and detect if they are logged however since the author of the thread is not in that specific user group the spoiler content wont show up on himself any ideas? below is my code
Code:
        <xen:if is="{xen:helper ismemberof, $visitor, 5}">
            {xen:raw $content}
        <xen:else />
            <xen:if is="{$visitor.user_id}">
            Sorry your are not in the 5 usergroup
            <xen:else />
                <a href="{xen:link register}">{xen:phrase register}</a> or <label for="LoginControl"><a href="{xen:link login}">Login</a></label> to view Spoiler content!
            </xen:if>

I tried to get this values however they sent out blank values
{xen:raw $post.user_id}
{xen:raw $thread.user_id}
 
Hello everyone. I'm aware of how to show something to someone depending on how many posts he/she has with thise following:

Code:
37. How can I show content to members with more than x posts?
<xen:if is="{$visitor.message_count} > x">
This content will show to members with more than x posts
</xen:if>

But what would be the code for showing something in say a post to everyone depending on how many posts/messages a user has? Something like the following doesn't appear to work:


Code:
<xen:if is="{$user.message_count} > 50">
This content will only apppear in the posts of those members who have more than 50 posts.
</xen:if>
 
Can I use a conditional to add a rel-cannonical to a specific resource? If so how would I do that? Thanks
 
What would be the conditional for the first post of a sticky thread ?
I tried this and it does not work

Code:
<xen:if is="{$post.position} == 0 AND {$thread.sticky} == 1">
Show content INSIDE first post of sticky thread
</xen:if>

And which template holds (first) post in order to insert the required conditional ?

I need to show a specific graphic for sponsored (sticky) threads.
 
Last edited:
Thanks @Brogan

I dumped the variables but apparently I was looking at the wrong template; post.
Yes, the $thread.sticky variable was there.

HTML:
array(42) {
  ["thread_id"] => int(123)
  ["node_id"] => int(7)
  ["title"] => string(54) "Title"
  ["reply_count"] => int(0)
  ["view_count"] => int(457)
  ["user_id"] => int(12345)
  ["username"] => string(14) "Author"
  ["post_date"] => int(1483995629)
  ["sticky"] => int(1)

It was the message template which needed to be tweaked. I made it to work by dropping the code just before the raw message, with following:

Code:
<xen:if is="{$post.position} == 0 AND {$thread.sticky} == 1">
    <div style="float:right;"><img src="/sticky-graphic.png"></div>
</xen:if>
    {xen:raw $message.messageHtml}

Thanks for your help.
 
Last edited:
Top Bottom