Page 1 of 1

CGBlog Pagination on Detail Pages

Posted: Tue Nov 24, 2015 9:13 pm
by mr.bacan
Hi, I've been using CGBlog Module for a client with great results. I've only needed to use the summary template to show weekly images, but now the client wants to add comments and facebook like button to each post, so I need to use the detail template to accomplish that, but I haven't been able to generate a pagination on detail pages. Is that possible? Pagination works great on summary templates but not otherwise.

Here's a link to the website so you have an idea. http://www.aliendefendermaky.com/en/story.html

Cms Version: 1.12.1

Installed Modules:

CMSMailer: 5.2.2
CMSPrinting: 1.0.5
FileManager: 1.4.5
MenuManager: 1.8.7
MicroTiny: 1.2.9
ModuleManager: 1.5.8
News: 2.15.2
Search: 1.7.13
ThemeManager: 1.1.8
Gallery: 2.0.3
FormBuilder: 0.8.1.2
TinyMCE: 2.9.12
CGSimpleSmarty: 1.9.1
CGExtensions: 1.49.11
CGContentUtils: 1.5.1
MleCMS: 1.11.4
CGSmartImage: 1.20.3
JQueryTools: 1.3.7
CGBlog: 1.13.2
Products: 2.24.2
CGFeedback: 1.7.5

Thanks in advance.

Re: CGBlog Pagination on Detail Pages

Posted: Tue Nov 24, 2015 10:15 pm
by calguy1000
but now the client wants to add comments and facebook like button to each post, so I need to use the detail template to accomplish that,
The detail view has no concept of pagination, it is for displaying a single article. therefore by definition there is no pagination.

There is a {cgblog_relative_article} plugin that can get the next and previous article by ascending date... but that plugin does not support filtering by category.

Re: CGBlog Pagination on Detail Pages

Posted: Wed Nov 25, 2015 5:12 pm
by mr.bacan
calguy1000 wrote:There is a {cgblog_relative_article} plugin that can get the next and previous article by ascending date... but that plugin does not support filtering by category.
Thanks a lot for your answer CG, I've tried it like this...

Code: Select all

{cgblog_relative_article article=$entry->url dir="next" assign="nextID"} (at the top of the template)
<a href="{$nextID}">Next</a>
But this didn't worked. I then tried article=$entry->id and it generates a link with the ID number (http://www.aliendefendermaky.com/102) but the pages have pretty url's and look like this http://www.aliendefendermaky.com/2015/1 ... age-6.htmlIs it possible to get the full url for each link?

Re: CGBlog Pagination on Detail Pages

Posted: Fri Nov 27, 2015 7:31 pm
by mr.bacan
I've been cracking my head off to get and answer for this with no luck, so I tried adding the CGFeedback module to the summary template and it worked perfectly, so I think this is the way I'll keep working. The downside is that I now also need a page listing all posts as a text link, but don't know if it's possible to link to a specific summary page automatically.

I would appreciate if someone with a solution could give me a hand.

Thanks in advance.

Re: CGBlog Pagination on Detail Pages

Posted: Fri Nov 27, 2015 8:43 pm
by Rolf
At www.cmscanbesimple.org/blog I use for previous/next buttons:

Code: Select all

{cgblog_relative_article article=$entry->id dir=prev assign=prev_id}
{cgblog_relative_article article=$entry->id dir=next assign=next_id}

{if !empty($prev_id)}
	<a class="btn btn_grey" href="{module_action_link module='CGBlog' action='detail' articleid=$prev_id urlonly='1'}">
		<span class="fa fa-arrow-circle-left"></span>&nbsp;&nbsp;Previous article
	</a>
{/if}
{if !empty($next_id)}
	<a style="float: right" class="btn btn_grey" href="{module_action_link module='CGBlog' action='detail' articleid=$next_id urlonly='1'}">
		Next article&nbsp;&nbsp;<span class="fa fa-arrow-circle-right"></span>
	</a>
{/if}

Re: CGBlog Pagination on Detail Pages

Posted: Fri Nov 27, 2015 8:49 pm
by Rolf
For a summary list view of articles you can use something like

Code: Select all

<ul>
  {foreach from=$items item=entry}
    <li><a href="{$entry->detail_url}" title="{$entry->title|escape:htmlall}">{$entry->title|escape}</a></li>
  {/foreach}
</ul>

Re: CGBlog Pagination on Detail Pages

Posted: Mon Nov 30, 2015 5:28 am
by mr.bacan
Thanks so much for your suggestions Rolf, I'll try them and let you know how it went.

Re: CGBlog Pagination on Detail Pages

Posted: Mon Nov 30, 2015 4:59 pm
by mr.bacan
Rolf wrote:

Code: Select all

{if !empty($prev_id)}
	<a class="btn btn_grey" href="{module_action_link module='CGBlog' action='detail' articleid=$prev_id urlonly='1'}">
		<span class="fa fa-arrow-circle-left"></span>&nbsp;&nbsp;Previous article
	</a>
{/if}
{if !empty($next_id)}
	<a style="float: right" class="btn btn_grey" href="{module_action_link module='CGBlog' action='detail' articleid=$next_id urlonly='1'}">
		Next article&nbsp;&nbsp;<span class="fa fa-arrow-circle-right"></span>
	</a>
{/if}
Thanks so much Rolf, this definitely solved the link issue, I just added an {else} to match on/off icons. There are also a couple of links to get the First and Last post, is it possible to get those links using the {module_action_link} tag you used?

Thanks again for all the help.