1. 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

Discussion in 'Styling and Customization Questions' started by Matthew Hawley, Jun 20, 2013.

  1. Matthew Hawley

    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: Jun 20, 2013
  2. Matthew Hawley

    Matthew Hawley Well-Known Member

  3. Slavik

    Slavik XenForo Moderator Staff Member

  4. xf_phantom

    xf_phantom Well-Known Member

    why not just report it?
    Curios if they'll get an alert again:sneaky:
     
    Matthew Hawley likes this.
  5. Matthew Hawley

    Matthew Hawley Well-Known Member

    @Mike can you help at all? Work your magic?
     
  6. Sheldon

    Sheldon Well-Known Member

    Relax, you only waited 20 minutes after posting to start tagging again. If someone knows, or can answer, I am certain they will.
     
    xf_phantom likes this.
  7. Mike

    Mike XenForo Developer Staff Member

    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.
     
    xf_phantom likes this.
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
  9. Matthew Hawley

    Matthew Hawley Well-Known Member

    Okay...so how do I use xen:calc?

    Nvm, just saw Jake Bunces post
     
  10. Matthew Hawley

    Matthew Hawley Well-Known Member

    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.
     
  11. MattW

    MattW Well-Known Member

    There is only 1 variable in your code above, so what are you trying to add it to?
     
  12. SneakyDave

    SneakyDave Well-Known Member

    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">
    
    
     
    MattW likes this.
  13. Matthew Hawley

    Matthew Hawley Well-Known Member

    It worked thanks!
     
    SneakyDave likes this.

Share This Page