Discussions
Activity
Sign In
How it works
Newscoop Support
item count in list_sections / list_topics / list_articles
Vote Up
0
Vote Down
BAUMANN Thomas
June 2012
Posts: 45
Member
Hi all,
how can I get the count of list_elements in a list_....
(even with constraints)?
I want to print:
There are YY sections in Issue #1
There are XX articles in Section #10
There are ZZ articles in with constraint
Best regards, and thanks for your help!
Thomas.
4 Comments
sorted by
Votes
Date Added
Vote Up
0
Vote Down
ljuba rankovic
June 2012
Posts: 156
Member
you can use
{{ $gimme->current_list->count }} - it should work for any kind of list
--
Ljuba Rankovic
Senior Front End Developer, Sourcefabric
ljuba.rankovic@sourcefabric.org
http://www.sourcefabric.org
http://www.twitter.com/Sourcefabric
Vote Up
0
Vote Down
BAUMANN Thomas
June 2012
Posts: 45
Member
can I do it like that _before_ the list_articles ? or is it only valid in the list_xxx section?
Vote Up
0
Vote Down
ljuba rankovic
June 2012
Posts: 156
Member
{{ $gimme->current_list->count }} is only valid inside the list, but you can either create two lists, first one somethnig like
{{ list_articles length="1" }}
{{ assign var="no_of_items" value=$gimme->current_list->count }}
{{ /list_articles }}
(lists loops only once, yet you get the number of all items that list might have)
or with one list, you can use
{{ list_articles }}
{{ if $gimme->current_list->at_beginning }}
<p>This list has
{{ $gimme->current_list->count }} items</p>
{{ /if }}
...
{{ /list_articles }}
- depending on what you need to achieve. Better is not to make unnecessary lists of course.
--
Ljuba Rankovic
Senior Front End Developer, Sourcefabric
ljuba.rankovic@sourcefabric.org
http://www.sourcefabric.org
http://www.twitter.com/Sourcefabric
Vote Up
0
Vote Down
BAUMANN Thomas
June 2012
Posts: 45
Member
The approach with $gimme->current_list->at_beginning is a good one.
This avoids having two loops.
Best regards,
Thomas.
Post edited by BAUMANN Thomas at 2012-06-27 11:43:44
Add a Comment
Start a New Discussion
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
8,397
Sourcefabric
↳
Announcements
25
Newscoop
↳
Newscoop Support
2,189
↳
Newscoop Development
722
↳
Newscoop Security
13
↳
Newscoop Documentation
17
↳
Newscoop Themes
69
Airtime
↳
Airtime Support
3,139
↳
Airtime Development
1,286
↳
Airtime Français
146
↳
Airtime Documentation
14
↳
Airtime Hacks
102
↳
Promote your station!
37
↳
Airtime Security
11
Booktype
↳
Booktype Support
277
↳
Booktype Development
55
↳
Booktype Documentation
7
Superdesk
↳
Superdesk Development
264
↳
Web Publisher
21
Poll
No poll attached to this discussion.
Top Posters
Albert FR
1978
Martin Konecny
1860
Andrey Podshivalov
1526
Voisses Tech
1423
John Chewter
899
Daniel James
844
Roger Wilco
784
hoerich
627
Paul Baranowski
389
Cliff Wang
339