Page 1 of 1
Latest 5 News
Posted: Sat Jun 06, 2009 7:29 am
by Hereistos
Heyho,
how to display the latest 5 news with the news addon on another page? I tried pagelimit and number, but this doesn't work since the pagination id being displayed ....
Thanks
Re: Latest 5 News
Posted: Sat Jun 06, 2009 8:35 am
by plger
Hereistos wrote:
I tried pagelimit and number, but this doesn't work since the pagination id being displayed ....
In the news summary template, the following part displays the pagination :
Code: Select all
{if $pagecount > 1}
<p>
{if $pagenumber > 1}
{$firstpage} {$prevpage}
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
{$nextpage} {$lastpage}
{/if}
So you could simply use a template in which this part is deleted, and the pagination will not be shown.
Re: Latest 5 News
Posted: Sat Jun 06, 2009 5:19 pm
by RonnyK
If you mean to display the selected one on another page,
{news number=5 detailpage="alias-of-the-targetedpage"}
This will show 5 news-summaries, clicking one, will open it in the page with the alias mentioned in the detailpage-parameter.
Ronny
Re: Latest 5 News
Posted: Sat Jul 11, 2009 5:11 pm
by DirtyMusic
Make a "Latest 5 News"
Go to "News" --> "Summarytemplates" and click "Create a new template" and name it: Newslatest
Copy and paste this code:
Code: Select all
{foreach from=$items item=entry}
<div class="NewsSummary">
{if $entry->postdate}
<div class="NewsSummaryPostdate">
{$entry->postdate|cms_date_format}
</div>
{/if}
<div class="NewsSummaryLink">
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape}</a>
</div>
<div class="NewsSummaryCategory">
{$category_label} {$entry->category}
</div>
{if $entry->author}
<div class="NewsSummaryAuthor">
{$author_label} {$entry->author}
</div>
{/if}
{if $entry->summary}
<div class="NewsSummarySummary">
{eval var=$entry->summary}
</div>
<div class="NewsSummaryMorelink">
[{$entry->morelink}]
</div>
{else if $entry->content}
<div class="NewsSummaryContent">
{eval var=$entry->content}
</div>
{/if}
{if isset($entry->extra)}
<div class="NewsSummaryExtra">
{eval var=$entry->extra}
{* {cms_module module='Uploads' mode='simpleurl' upload_id=$entry->extravalue} *}
</div>
{/if}
{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
<div class="NewsSummaryField">
{if $field->type == 'file'}
<img src="{$entry->file_location}/{$field->value}"/>
{else}
{$field->name}: {eval var=$field->value}
{/if}
</div>
{/foreach}
{/if}
</div>
{/foreach}
Then go to the page where you want the latest news and add this code:
Code: Select all
{news number='5' summarytemplate='Newslatest'}