Is there a way to load images based on how many messages are in a thread view?

RobinHood

Well-known member
This is for a sidebar, I only want it to load 1 image by default, but if there's more than x posts loaded onto the page it should load a second image, and if more than y posts on a page it should load a 3rd image.

Any ideas?

Edit: Actually, ideally I'd like to check the height of all the messages, but that could perhaps vary if images are being loaded from an external source?
 
Admin CP -> Appearance -> Templates -> thread_view

Add this code:

Code:
<xen:foreach loop="$posts" value="$post" count="$count">
</xen:foreach>

Now you can reference {$count} anywhere after this code to check the number of posts on the page. Example:

Code:
<xen:if is="{$count} > 15">

<xen:elseif is="{$count} > 10" />

<xen:elseif is="{$count} > 5" />

</xen:if>
 
Hmmm...I seem to get the following error on the thread after that:

Fatal error: Cannot use object of type XenForo_BbCode_TextWrapper as array in /home/domain/public_html/library/XenForo/Template/Abstract.php(265) : eval()'d code on line 663
 
Back
Top Bottom