Groups conditional in template

najaru

Active member
Hi.
If i want to insert a html code in template, and i want that this code is visible ONLY at 1 o 2 groups, what code i have to use?

thanks
 
Awesome lawrence, would you happen to know how to set a condition for say if the post is number 1, that way we can use this code for guests and is post 1 thus being useful for an advertisement banner.

Cheers.
 
It's $visitor.user_group_id

The $user was for a foreach loop.

For post number:

<xen:if is="!{$post.position}">

</xen:if>

The first post is position 0. If you would like to check for the 3rd post, try this:

<xen:if is="{$post.position} == '2'">

</xen:if>
 
It's $visitor.user_group_id

The $user was for a foreach loop.

For post number:

<xen:if is="!{$post.position}">

</xen:if>

The first post is position 0. If you would like to check for the 3rd post, try this:

<xen:if is="{$post.position} == '2'">

</xen:if>

Sorry to bump this up but I cannot get your conditional to work in thread_view, should this one work in thread view? I am using it just after
Code:
<xen:edithint template="attached_files" />
    </ol>
 
I tested it in thread_view, placed at the very bottom of the template just above these two closing tags:

</xen:set>
</xen:include>

for example:

Code:
<xen:if is="!{$post.position}">
My advertisement code here that will display right after post #1
</xen:if>

    </xen:set>
    
</xen:include>
 
Im not seeing it in the source using this:

Code:
<xen:if is="{$visitor.is_admin}">
<xen:if is="!{$post.position}">
WOWOWOW
</xen:if>
</xen:if>

and thats like so in the thread_view template:

Code:
<xen:include template="share_page">
    <xen:set var="$url">{xen:link 'canonical:threads', $thread}
<xen:if is="{$visitor.is_admin}">
<xen:if is="!{$post.position}">
WOWOWOW
</xen:if>
</xen:if>
</xen:set>
</xen:include>

I also tried it after the last closing tags without it showing in the source.

EDIT: All is well now, I needed to use it after the include post code for it to work as needed.

Thank you
 
Top Bottom