Page 1 of 1

Pagination on news page [solved]

Posted: Fri Aug 17, 2007 8:41 am
by Richardo P
Hi everyone.

Firstly thanks for such an aesome CMS.

I am running CMS Made Simple 1.1 "Samoa".  My problem is I am trying to get 'pagination' working on a news page.  I have followed the guide here:

http://wiki.cmsmadesimple.org/index.php/User_Handbook/Admin_Panel/Content/News/User_Defined_Tags

Everything as far as i can see is correct.  My page is a content page, my global tag is named correctly, my page has the correct content.  The news displays, but I dont get the added features appearing. I get this error message at the top of the content area

Code: Select all

string(126) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag 'newsindex' (Smarty_Compiler.class.php, line 590)"
What have I done wrong?

Here is my news page:

Code: Select all

{newsindex number='5' start='0' category='General' count_expired='true' delimiter='|' older='Older Stories' newer='Newer Stories'}

{news}

{$news_newer_link} {$news_crumbs} {$news_older_link}
Here is my news template:

Code: Select all

<!-- Start News Display Template -->

<h1>BB Music House  - The Latest</h1>

{if $pagecount > 1}

  <p>

{if $pagenumber > 1}
{$firstpage} {$prevpage} 
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
 {$nextpage} {$lastpage}
{/if}

</p>

{/if}
{foreach from=$items item=entry}

<div class="NewsSummary">

<h1 id="NewsPostDetailTitle">{$entry->title}</h1>

{if $entry->formatpostdate}
	<div class="NewsSummaryPostdate">
		{$entry->formatpostdate}
	</div>

{/if}

{if $entry->summary}
	<div class="NewsSummarySummary">
		{eval var=$entry->summary}
	</div>


	<div class="NewsSummaryMorelink">
		
<p>{$entry->morelink}</P>
	
</div>

<br />

{else if $entry->content}

	<div class="NewsSummaryContent">
		{eval var=$entry->content}
	</div>
{/if}

</div>
{/foreach}

<!-- End News Display Template -->
What am I doing wrong?

Thanks in advance everyone

Re: Pagination on news page

Posted: Fri Aug 17, 2007 8:52 am
by RonnyK
Richardo,

when I read the WIKI link correctly there is no need for the UDT in the latest NEWS release on CMSMS 1.1. The first line of the link you provided states that.

What version of NEWS are you running, I think that the default version can be updated.

Ronny

Re: Pagination on news page

Posted: Fri Aug 17, 2007 8:58 am
by Richardo P
Thanks,

I noticed that id made a silly mistake and added a gloabal content block instead of a custom tag.  However it still doesn't work properly.

All I want to achieve is to have links at the bottom of the page 1 2 3 4 5 etc and limit each page to 2 news summaries.  Is this now possible with the install i have without adding stuff?

How would I go about this?

Richard

Re: Pagination on news page

Posted: Fri Aug 17, 2007 9:06 am
by RonnyK
On

http://demo.krijt.eu/index.php?page=news

I just call

Code: Select all

{news number="1"}
This will show 1 per page with pagination as there are two entries in total.

You said that nothing was shown at all. Are all entries marked with status "Publised" and not expired. Is your user haveing the rights to "Approve News For Frontend Display"

Do you have a link.

Ronny

Re: Pagination on news page

Posted: Fri Aug 17, 2007 9:32 am
by Richardo P
Ronny,

Yes, the news items are there, They were showing before I tired to add this extra functionality.

My news page can be seen here:

http://www.bbmusichouse.co.uk/index.php?page=news

Theres two things I'm trying to do really.

1.  Display only 2 news summaryies per page.
2  Have the  next previous links at the bottom of the page instead of the top.

Here is my news summary template:

Code: Select all

<!-- Start News Display Template -->

<h1>BB Music House  - The Latest</h1>

{if $pagecount > 1}

  <p>

{if $pagenumber > 1}
{$firstpage} {$prevpage} 
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
 {$nextpage} {$lastpage}
{/if}

</p>

{/if}
{foreach from=$items item=entry}

<div class="NewsSummary">

<h1 id="NewsPostDetailTitle">{$entry->title}</h1>

{if $entry->formatpostdate}
	<div class="NewsSummaryPostdate">
		{$entry->formatpostdate}
	</div>

{/if}

{if $entry->summary}
	<div class="NewsSummarySummary">
		{eval var=$entry->summary}
	</div>


	<div class="NewsSummaryMorelink">
		
<p>{$entry->morelink}</P>
	
</div>

<br />

{else if $entry->content}

	<div class="NewsSummaryContent">
		{eval var=$entry->content}
	</div>
{/if}

</div>
{/foreach}



<!-- End News Display Template -->
Under Pages > news

Number to Display (empty shows all records):  2
Start displaying at the nth item:  0

Thanks for sticking with me here, I started of on the wrong track but feel I'm getting there now.  I'm still a little lost as to whats going wrong though

Richard

Re: Pagination on news page

Posted: Fri Aug 17, 2007 9:41 am
by RonnyK
Richardo,

remove the "0" in the "Start displaying at the nth item:" and they will show, because of the zero it starts at 0 instead of 1.
Just leave the field blank.

Ronny

Re: Pagination on news page

Posted: Fri Aug 17, 2007 9:44 am
by RonnyK
To have the next/prev on the bottom you should move:

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}
all the way down, outside the "foreach"

Ronny

Re: Pagination on news page

Posted: Fri Aug 17, 2007 11:02 am
by Richardo P
Thanks again:

Heres my template now

Code: Select all

<!-- Start News Display Template -->

<h1>BB Music House  - The Latest</h1>


{foreach from=$items item=entry}

<div class="NewsSummary">

<h1 id="NewsPostDetailTitle">{$entry->title}</h1>

{if $entry->formatpostdate}
	<div class="NewsSummaryPostdate">
		{$entry->formatpostdate}
	</div>

{/if}

{if $entry->summary}
	<div class="NewsSummarySummary">
		{eval var=$entry->summary}
	</div>


	<div class="NewsSummaryMorelink">
		
<p>{$entry->morelink}</P>
	
</div>

<br />

{else if $entry->content}

	<div class="NewsSummaryContent">
		{eval var=$entry->content}
	</div>
{/if}

</div>
{/foreach}

{if $pagecount > 1}

{if $pagenumber > 1}
{$firstpage} {$prevpage} 
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
 {$nextpage} {$lastpage}
{/if}

{/if}



<!-- End News Display Template -->

the formating of it is now fine, except the more links at the bottom arent working.

See:

http://www.bbmusichouse.co.uk/index.php?page=news

Re: Pagination on news page

Posted: Fri Aug 17, 2007 11:13 am
by RonnyK
I notice the same behaviour when you choose news as a content-type. Make it a normal content and just add:

Code: Select all

{news number="2"}
In the content. That will work.

Ronny

Re: Pagination on news page

Posted: Fri Aug 17, 2007 12:53 pm
by Richardo P
Thanks,

that works brilliantly now.  Problem solved.