XF 2.2 How to have and display a cumulative total of a variable sent to the member_list_macros template?

Stuart Wright

Well-known member
I have this code in the custom whoreplied_list template
HTML:
                    <li class="block-row block-row--separated userList-row js-filterSearchable">
                        <xf:set var="$extraTemplate">
                            <div class="whoreplied--postcount">
                                <xf:if is="$canSearch">
                                    <a href="{{ link('search/search', '', {'c[users]':{$user.username}, 'search_type':'post', 'c[thread]': $thread.thread_id, 'order':'date'}) }}" target="_blank" title="{{ phrase('whoreplied_see_posts')|for_attr }}">
                                        {$user.ThreadUserPost.{$thread.thread_id}.post_count|number}
                                    </a>
                                <xf:else />
                                    {$user.ThreadUserPost.{$thread.thread_id}.post_count|number}
                                </xf:if>
                                ({{ (100* $user.ThreadUserPost.{$thread.thread_id}.post_count / ($thread.reply_count))|number(2) }}%)
                            </div>
                        </xf:set>
                        <xf:macro template="member_list_macros"
                                  name="item"
                                  arg-user="{$user}"
                                  arg-extraData="{$extraTemplate}"
                                  arg-extraDataBig="1"
                                  />
                    </li>
which has this line added
Code:
({{ (100* $user.ThreadUserPost.{$thread.thread_id}.post_count / ($thread.reply_count))|number(2) }}%)
which is a tweak to @Xon's
addon and the tweak displays the % total of posts in the thread for each person.
1.webp
What I'd like to do is add the cumulative percentage so I can see how many people are responsible for 50% of the posts in a thread.
Is there a way to have an additional number for the cumulative value of
Code:
{{ (100* $user.ThreadUserPost.{$thread.thread_id}.post_count / ($thread.reply_count))|number(2) }}
?
I'm thinking a variable which has the value added to it in each operation of the macro.
Thanks
 
Back
Top Bottom