Discussions
Activity
Sign In
How it works
Newscoop Support
[SOLVED] how to hide sections without articles
Vote Up
0
Vote Down
hhunor
May 2014
Posts: 16
Member
Hello!
How to hide empty sections (sections that doesn't have any article) in list_section?
Thank you!
Hunor Habram
Post edited by hhunor at 2014-05-12 15:05:32
3 Comments
sorted by
Votes
Date Added
Vote Up
1
Vote Down
Sebastian Olsson (2)
May 2014
Posts: 121
Member
{{ list_sections }}
{{ if $gimme->current_list->at_beginning }}
<ul>
{{ /if }}
{{ list_articles length="1" }}
{{ /list_articles }}
{{ if ! $gimme->prev_list_empty }}
<li>
<a href="{{ url options="section" }}">
{{ $gimme->section->name }}
</a>
</li>
{{ /if }}
{{ if $gimme->current_list->at_end }}
</ul>
{{ /if }}
{{ /list_sections }}
Vote Up
0
Vote Down
hhunor
May 2014
Posts: 16
Member
Thank you Sebastian for quick and great answer.
You will notice that odd sections on the left side and even on right side.
I do this (the following code), but when a section is missing, it will put two section on same side. We must put counter after filtering. But how?
{{assign var="counter" value=0 }}
{{ list_sections constraints="number greater 9 number smaller 21" }}
{{ assign var="counter" value=$counter+1 }}
{{ list_articles length="1" }}
{{ /list_articles }}
{{ if ! $gimme->prev_list_empty }}
<aside class="extra-articles {{if $counter is odd}}left-block{{else}}right-block{{/if}}">
<h4
class="section-title"><a href="{{ uri options="section"
}}"><b>{{ $gimme->section->name
}}</b></a></h4>
{{ list_articles length="4" ignore_issue="false" order="bysectionorder asc" }}
<div class="link">
<i class="icon-double-angle-right"></i>
<a href="{{ uri options="article" }}"> {{ $gimme->article->cim }}
{{* <span> ({{ $gimme->issue->name }})</span> *}} </a>
</div>
{{ /list_articles }}
<a href="{{ uri options="section" }}" class="solid-button pull-right">Még több</a>
</aside>
{{ /if }}
{{ /list_sections }}
Here is the class assigned to sections. Notice the two left block one after another>
<aside class="extra-articles left-block"></aside>
<aside class="extra-articles right-block"></aside>
<aside class="extra-articles left-block"></aside>
<aside class="extra-articles left-block"></aside>
<aside class="extra-articles right-block"></aside>
<aside class="extra-articles left-block"></aside>
<aside class="extra-articles right-block"></aside>
Post edited by hhunor at 2014-05-12 14:55:17
Vote Up
0
Vote Down
hhunor
May 2014
Posts: 16
Member
I solved it!
The line
{{ assign var="counter" value=$counter+1 }}
put after IF statement:
...
{{ if ! $gimme->prev_list_empty }}
{{ assign var="counter" value=$counter+1 }}
<aside class="extra-articles {{if $counter is odd}}left-block{{else}}right-block{{/if}}">
...
and it is working!
Thank you Sebastian one more time!
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