• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Groups conditional in template

najaru

Active member
#1
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
 

MentaL

Active member
#3
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.
 

Lawrence

Well-known member
#4
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>
 

Michael

Active member
#6
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>
 

Lawrence

Well-known member
#7
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>
 

Michael

Active member
#8
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