SOLVED : Paginating News
-
Eskymo
SOLVED : Paginating News
Another simple question for you experts out there...
I want my news page to paginate...I've used this within my news page template:
{news moretext="read more" detailpage="newsdetail" pagelimit="5"}
and so the pagelimit is set to 5 - it does indeed show only 5 news stories, but even though I've put in 6 test articles no pagination appears to show the 6th news story on another page...is there code that I need to put in place to do this?
I want my news page to paginate...I've used this within my news page template:
{news moretext="read more" detailpage="newsdetail" pagelimit="5"}
and so the pagelimit is set to 5 - it does indeed show only 5 news stories, but even though I've put in 6 test articles no pagination appears to show the 6th news story on another page...is there code that I need to put in place to do this?
Last edited by Eskymo on Wed Nov 07, 2007 9:31 am, edited 1 time in total.
-
cyberman
Re: Paginating News
Default templates contains code for pagination - your templates too?
{if $pagecount > 1}
{if $pagenumber > 1}
{$firstpage} {$prevpage}
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber
{/if}
{foreach from=$items item=entry}
{if $entry->formatpostdate}
{$entry->formatpostdate}
{/if}
{$entry->titlelink}
{$category_label} {$entry->category}
{if $entry->author}
{$author_label} {$entry->author}
{/if}
{if $entry->summary}
{eval var=$entry->summary}
[{$entry->morelink}]
{else if $entry->content}
{eval var=$entry->content}
{/if}
{/foreach}
-
Eskymo
Re: Paginating News
including this
in the summary template puts pagination onto the news story I have on the homepage, so I took this out. I want the pagination to appear only once and only at the bottom of my news page.
I've just re-inserted the code so you can see what I mean...
homepage pagination on the news story on the homepage [not wanted]
http://www.techsinthecity.co.uk/devsite/
so would the best thing to do be to create a separate news summary template for the homepage? How would I call that specific template on the homepage if that is what to do?
Code: Select all
{if $pagecount > 1}
<p>
{if $pagenumber > 1}
{$firstpage} {$prevpage}
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
{$nextpage} {$lastpage}
{/if}
</p>
{/if}
I've just re-inserted the code so you can see what I mean...
homepage pagination on the news story on the homepage [not wanted]
http://www.techsinthecity.co.uk/devsite/
so would the best thing to do be to create a separate news summary template for the homepage? How would I call that specific template on the homepage if that is what to do?
Last edited by Eskymo on Wed Nov 07, 2007 9:04 am, edited 1 time in total.
Re: Paginating News
Eskymo,
from the help of the NEWS.
So if you create a new template for the main-page, you can arrange this. Otherwise you could try inserting a (UNTESTED):
around the summary-logic, that way it will only be shown on other pages than the one holding 'home' as alias
Ronny
from the help of the NEWS.
Without the parameter, the default template will be used. Specific calling of a template will lead to the use of that template.(optional) summarytemplate="" - Use a separate database template for displaying the article summary. This template must exist and be visible in the summary template tab of the News admin, though it does not need to be the default. If this parameter is not specified, then the current template marked as default will be used.
So if you create a new template for the main-page, you can arrange this. Otherwise you could try inserting a (UNTESTED):
Code: Select all
{if $page_alias neq 'home'}
***
{/if}
Ronny
-
Eskymo
Re: Paginating News
I think I get what you mean - will give it a go - thanks for the speedy response!
Re: Paginating News
Eskymo,
I meant around the pagination-logic, and I tested it already. It works. So you can work with a single summary-template where pagination won't be shown on the main-page.
I meant around the pagination-logic, and I tested it already. It works. So you can work with a single summary-template where pagination won't be shown on the main-page.
Ronny
{if $page_alias neq 'home'}
{if $pagecount > 1}
{if $pagenumber > 1}
{$firstpage} {$prevpage}
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber
{/if}
{/if}
-
Eskymo
Re: SOLVED : Paginating News
Well I've created a separate template and that works too...it also gives me the option of styling the news page slightly differently and adding dividers between each summary...but I like your simple solution too - will add that to my 'top tips list' spreadsheet for next time I do a site with cmsms.
I love this CMS!
I love this CMS!
Re: SOLVED : Paginating News
Eskymo,
another trick to style NEWS differently, is making them odd/even. This will cycle the styling.
News template:
another trick to style NEWS differently, is making them odd/even. This will cycle the styling.
News template:
CSS:
{foreach from=$items item=entry key=j}
{if $j % 2 == 1}
{else}
{/if}
Ronny.NewsSummary {
margin:5px 0px;
}
.NewsSummary_odd {
margin:5px 0px;
background: #99B3E5;
}
-
Eskymo
Re: SOLVED : Paginating News
I did wonder how that would be done - so I could alternate the background colours using this...cool!
Thanks
E
Thanks
E
Re: SOLVED : Paginating News
You could style whatever you want, I just put the background in as an example. You get a different class, so style what you want.
Ronny
Ronny

