XF 2.2 Post Macros Question

Tony Cossio

Member
I have a line of code which I am using in post_macros to separate the reactions. Instead of three reactions it shows all of them separated with a counter;

<xf:foreach loop="$post.reactions" key="$reactionID" value="$reaction"><xf:trim>
<li><xf:reaction id="{$reactionID}" small="true" showtitle="true" appendtitle="x {$reaction|number}" /><span class="reactionCount"><span class="reactionCountSmall"></li>

It works fine, except when I have 5+ reactions the reactions bar gets cluttered. I want to collapse it where it does not show the title. So obviously a conditional statement that gets rid of "showtitle" after more than 5 post. Where I have an issue is I do not know how or where to put the counter at in the statement or it's syntax. (assume somewhere under "value=").

Another issue is when I like posts it does not update who liked unless I refresh. Any thoughts?
 
Untested but you should be able to use something like this inline: {{ $reaction|number > 5 ? 'showtitle="true"' : '' }} .
 
Back
Top Bottom