Dear all,
For years we have been using a setup where three news blocks on the site each showed 1 news item, for the simple reason that they are all styles slightly different.
After 'upgrading' from 1.8.x to 1.12, however (which by the way we did via a complete new install and mostly manual except for the pages) a strange problem appeared.
When the parameter number=4, number=10 etc. is added in the {news} line this works fine. When we get to number=1 though, 2 items are being displayed... The same behaviour happens with the pagelimit=1 parameter.
To solve this strange issue I have these two questions. The answer to either one will be great and enough to solve my situation.
1. Is this known behaviour and is there a known fix or a location in the code of the news module itself where this is likely to be located?
2. is there a way to show the 3 top news items each slightly differently styled from within the news template itself? This is the reason why I went with the set up as described above in the first place.
Many thanks.
EDIT: the problem manifests itself regardless of the chosen news template.
News number=1 shows 2 news items [CMSMS 1.12]
-
- New Member
- Posts: 3
- Joined: Tue Aug 18, 2015 8:04 am
Re: News number=1 shows 2 news items [CMSMS 1.12]
It is a known issue and fixed for the next version.
<div class="news_item {if $entry@iteration == 1}first{elseif $entry@iteration == 2}second{else}third{/if}">
As with Smarty and CMSms there are a hundred ways to do something. One of the simplist is to check the {foreach} @iteration (http://www.smarty.net/docs/en/language. ... oreach.tpl)2. is there a way to show the 3 top news items each slightly differently styled
<div class="news_item {if $entry@iteration == 1}first{elseif $entry@iteration == 2}second{else}third{/if}">
Re: News number=1 shows 2 news items [CMSMS 1.12]
Off topic a little, but great tip about {foreach} @iteration . I certainly hadn't realised that! Very helpful.
Thanks Jeff.
Thanks Jeff.
Re: News number=1 shows 2 news items [CMSMS 1.12]
Workaround would be to not use a foreach loop or break the loop after first iteration.
Though it would be easier to just use your current template and add {break} just before the closing {/foreach} tag
Code: Select all
{$entry=$items[0]}
<div class="news-summary">
<h2>$entry->title</h2>
<p>$entry->summary</p>
</div>
Code: Select all
<!-- Start News Display Template -->
{foreach from=$items item=entry}
<div class="NewsSummary">
...
</div>
{break}
{/foreach}
<!-- End News Display Template -->