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

How to get ALL itemCount alerts to show in one itemCount

Matthew Hawley

Well-known member
#1
So basicly I want the moderation, reports, and users needing approval itemcount alerts, to show in one item count alert. This is what I tried

Code:
<span class="itemLabel">{xen:phrase moderation_queue_short}:</span><span class="itemCount {xen:if '({$session.moderationCounts.total} AND {$session.reportCounts.total} AND {$session.userModerationCounts.total}', 'alert'}">{$session.moderationCounts.total}</span></a>
Didn't work

I suspect @Kier and @Mike would know so lets send them an alert...
 
Last edited:

Mike

XenForo developer
Staff member
#7
Template editing questions go in the styling forum. Code related questions go in the dev forum.

You should use xen:calc to add the values.
 

Jake Bunce

XenForo moderator
Staff member
#8
As Mike said, use xen:calc to get the total:

Code:
<xen:set var="$totalCounts">{xen:calc '{$session.userModerationCounts.total} + {$session.reportCounts.total} + {$session.moderationCounts.total}'}</xen:set>
Now you can use {$totalCounts} in the template.
 
#10
As Mike said, use xen:calc to get the total:

Code:
<xen:set var="$totalCounts">{xen:calc '{$session.userModerationCounts.total} + {$session.reportCounts.total} + {$session.moderationCounts.total}'}</xen:set>
Now you can use {$totalCounts} in the template.
Okay so, how would I use that in this?

Code:
<span class="itemCount {xen:if {$session.moderationCounts.total}, 'alert'}">{$session.moderationCounts.total}</span></a>                     
                                                        <div class="Menu">
I keep trying but I get errors.
 

MattW

Well-known member
#11
Okay so, how would I use that in this?

Code:
<span class="itemCount {xen:if {$session.moderationCounts.total}, 'alert'}">{$session.moderationCounts.total}</span></a>                    
                                                        <div class="Menu">
I keep trying but I get errors.
There is only 1 variable in your code above, so what are you trying to add it to?
 

SneakyDave

Well-known member
#12
Something like this perhaps? Just guessing.
Code:
<xen:set var="$totalCounts">{xen:calc '{$session.userModerationCounts.total} + {$session.reportCounts.total} + {$session.moderationCounts.total}'}</xen:set>
<span class="itemCount {xen:if {$totalCounts}, 'alert'}">{$totalCounts}</span></a>                     
                                                        <div class="Menu">