How to get ALL itemCount alerts to show in one itemCount

Matthew Hawley

Well-known member
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:
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.
 
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.
 
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?
 
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">
 
Top Bottom