Latest 5 News

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Hereistos
Forum Members
Forum Members
Posts: 29
Joined: Sat Apr 11, 2009 12:42 am

Latest 5 News

Post 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
User avatar
plger
Forum Members
Forum Members
Posts: 196
Joined: Wed Oct 15, 2008 10:38 am

Re: Latest 5 News

Post 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.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm
Location: Raalte, the Netherlands

Re: Latest 5 News

Post 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
User avatar
DirtyMusic
Forum Members
Forum Members
Posts: 15
Joined: Sat Nov 08, 2008 9:27 am

Re: Latest 5 News

Post 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'} 
Post Reply

Return to “Modules/Add-Ons”