diydeveloper / cms-canvas

Laravel CMS
36 stars 33 forks source link

How do I use the pagination tag? #13

Closed cosmomathieu closed 8 years ago

cosmomathieu commented 9 years ago

Hello,

I am continuing development on this CMS and think it's awesome. I'll be looking to port it to CI3 soon!

For the time being, can you give me some insight to how one would use the following pagination tags? paginate="top"
paginate="bottom"
*paginate="both" I know I would put them in the template, but that's about it. Couldn't find any docs on this on your website.

Thank you

cosmomathieu commented 8 years ago

I have figured out that by adding {{paginate}} {{ pagination_links }} {{/paginate}} tags to the a template I can generate the proper queries and html pagination links. However, I am not sure whether or not I need to add a custom route for the "p1, p2, p3.." that are appended to the url when you click on a link (of course this is giving me an error 404). Is there some other mechanism built into the content plugin that set's the route? Or is the route only to be set in the routs[''] array?

cosmomathieu commented 8 years ago

I have figured it out. I'm posting my steps here in the event someone else runs into the same issue. Step 1 - Go to the content type for which you want to enable pagination, then settings and check the box that says Dynamic routing. Step 2 - In the field that appears after ticking the checkbox above enter the url slug of your page e.g. "blog" so that the full url reads http://mywebsite.com/blog. Step 3 - In your template add the following tags within your content loop: {{paginate}} {{ pagination_links }} {{/paginate}}
Step 4 - Add the following parameter (paginate = "top" (or "bottom", or "both")) inside the content opening tags e.g. {{ content:entries limit="10" paginate="top"}} what this does is pagintate your result set by 10 items.

Hope this helps someone else!