Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hello,

So I have a profile page for video makers.
Each video maker pages (clonable) have a repeatable region that allow me to add rows that defines that films they have made.
So if a video maker has made 3 movies, I add 3 rows in that repeatable region.

Then, I have a page where I show all video makers.
But I want to be able to show how many movies there is, all video makers together.
For example :

Code: Select all
Video maker #1 : 7 films (so 7 rows in the repeatable region)
Video maker #2 : 5 films
Video maker #3 : 5 films
Video maker #3 : 9 films


I want to show the total, which would be the number 11 in that case.

These video makers on that page are added using the Mosaic element.

Here's what I have for now, but it's just showing individual numbers, per video maker. I want a total for all of them on that page.
Code: Select all
<cms:capture into='my_variable' scope='global'>
  <cms:show_mosaic 'playlist_formateurs'><cms:set formateur_name="<cms:related_pages 'formateurs_dropdown'><cms:show k_page_name/></cms:related_pages>" />
          <cms:pages masterpage="formation.php" custom_field="formateurs_dropdown=<cms:show formateur_name/>">
              <cms:show_repeatable 'formateur_videos'><cms:if k_count="1"><cms:show k_total_records/><cms:if k_count != k_total_records>+</cms:if></cms:if></cms:show_repeatable>
          </cms:pages>
  </cms:show_mosaic>
</cms:capture>


I can use javascript if needed to make an operation. But what I'm getting is :

Code: Select all
7+                                    5+                                    5+                                    9+

With a bunch of white spaces, and a "+" at the end.

If I can get the total number, without the use of Javascript, that would be perfect.
If not, then how can I get the following result :
Code: Select all
7+5+5+9

instead of that line filled with white spaces and a trailing "+"?

Thanks a lot
The easiest is to apply cms:add (or cms:incr) and a counter variable in global scope.
Thanks!

I managed to make it work with your help. Here's the code I have used :

Code: Select all
<cms:set film_count='0' scope='global'/>
<cms:capture into='calculation' scope='global'>
  <cms:show_mosaic 'playlist_moviemakers'><cms:set moviemaker_name="<cms:related_pages 'moviemakers_dropdown'><cms:show k_page_name/></cms:related_pages>" />
          <cms:pages masterpage="formation.php" custom_field="moviemakers_dropdown=<cms:show moviemaker_name/>">
              <cms:show_repeatable 'moviemaker_videos'><cms:if k_count="1"><cms:show k_total_records/><cms:incr film_count "<cms:show k_total_records/>" /></cms:if></cms:show_repeatable>
          </cms:pages>
  </cms:show_mosaic>
</cms:capture>

<h3 class="video_count"><cms:show film_count /> movies</h3>


Hopefully this will help other people.
Thanks again
3 posts Page 1 of 1
cron