Did you try the obvious 1st?I'm looking for equivalent to this conditional statement for XF2:
Code:<xen:if is="{xen:count $posts} > 0" />
Thank you for helping.
<xf:if is="{xf:count $posts} >2" />
<xf:if is="count($posts) >2" />
if (count($posts) >2) { }
<xf:if is="count($posts) >2" >
... ad code...
</xf:if
if (count($posts) >2)
{
... ad code...
}
Exactly what I did, but it's not working in thread view sidebar widget.You really need:
<xf:if is="count($posts) >2" >
... ad code...
</xf:if>
<xf:if is="count($posts) >2">
<div class="adSense ad_above_content" align="center" style="padding: 30px 0px; border: 1px solid #e4e4e4; border-radius: 5px; background: #3d70d2;">
<div align="center" style="color: #fff;">FMU__thread_view_sidebar</div>
</div>
</xf:if
... but it's still not working in Thread view: Sidebar position.<xf:widgetpos id="thread_view_sidebar" context-thread="{$thread}" context-posts="{$posts}" position="sidebar" />
<xf:if is="count($posts) >2">
<div class="adSense ad_above_content" align="center" style="padding: 30px 0px; border: 1px solid #e4e4e4; border-radius: 5px; background: #3d70d2;">
<div align="center" style="color: #fff;">FMU__thread_view_sidebar</div>
</div>
</xf:if>
<xf:if is="count($context.posts) > 2">
<div class="adSense ad_above_content" align="center" style="padding: 30px 0px; border: 1px solid #e4e4e4; border-radius: 5px; background: #3d70d2;">
<div align="center" style="color: #fff;">FMU__thread_view_sidebar</div>
</div>
</xf:if>
<xf:if is="$thread.reply_count > 2">
<!-- blah -->
</xf:if>
<xf:if is="count($__globals.posts) > 2">
<!-- blah -->
</xf:if>
<xf:if is="$thread.reply_count > 2">
TEST
</xf:if>
<xf:if is="$template == 'thread_view'">
TEST
</xf:if>
When used on ad location > container sidebar (above), the code does not work.Most of this isn't needed.
If you only want to show ads on a thread which has a certain number of replies, then you will just want this:
If you want it dependent on the number of posts on the page then you could always use __globals:HTML:<xf:if is="$thread.reply_count > 2"> <!-- blah --> </xf:if>
HTML:<xf:if is="count($__globals.posts) > 2"> <!-- blah --> </xf:if>
We use essential cookies to make this site work, and optional cookies to enhance your experience.