PhileCMS / Phile

A flat file CMS with a swappable parser and template engine.
https://philecms.github.io/
Other
257 stars 49 forks source link

Pagination #58

Closed james2doyle closed 10 years ago

james2doyle commented 10 years ago

Something we never really discussed. But my blog is getting close to 100 articles on a single page. I would like to split them.

I was thinking something like example.com/2 would load the second chunk of pages based on $config["posts_per_page"] or a similar style.

So I am thinking of building a plugin for this. Does anyone have any conventions before I start?

Frodox commented 10 years ago

+1, I also thought about it, that somewhen I will need it :)

Is it possible to render only posts on current page (for example, if it's 3rd page, it's useless to render all pages)? So, if blog would have 1000+ articles, it wouldn't a big problem, because only $config["posts_per_page"] would be rendered

STOWouters commented 10 years ago

Yeah, pagination is a really good idea :+1:

When I used Pico, I used the Pico pagination plugin, I found the pagination_limit (the posts_per_page in this case) and pagination_page_indicator really convenient in particular.

jacmgr commented 10 years ago

I did a conversions of the Pico pagination plugin. It may not be what you are after. And it requires a change to the Core.php. We need a way to modify the uri string in a plugin so you don't get 404. I changed this line in the Core.php to pass the uri by reference to plugins.

 Event::triggerEvent('request_uri', array('uri' => &$uri));

Then the plugin pretty much just duplicates exactly what the pico plugin does; use the Pico plugin documentation to see what tags you can use in your templates. You can download the plugin zip. Maybe give someone ideas for a better phile plugin.

james2doyle commented 10 years ago

Nice! I'll have to take a look at it this weekend when I get the chance.

On Fri, Feb 28, 2014 at 10:39 AM, jacmgr notifications@github.com wrote:

I did a conversions of the Pico pagination pluginhttps://github.com/rewdy/Pico-Pagination. It may not be what you are after. And it requires a change to the Core.php. We need a way to modify the uri string in a plugin so you don't get 404. I changed this line in the Core.php to pass the uri by reference to plugins.

Event::triggerEvent('request_uri', array('uri' => &$uri));

Then the plugin pretty much just duplicates exactly what the pico plugin does; use the Pico plugin documentation to see what tags you can use in your templates. You can download the plugin ziphttp://www.jhinline.com/philecms/downloads/phileJacPagination.zip. Maybe give someone ideas for a better phile plugin.

Reply to this email directly or view it on GitHubhttps://github.com/PhileCMS/Phile/issues/58#issuecomment-36362602 .

James Doyle

t: @james2doyle https://twitter.com/james2doylew: ohdoylerules.com http://ohdoylerules.com

maxArturo commented 10 years ago

I ran into this issue recently while toying with the 'blog' theme. All I did was add a setting in config.php a-la $config['maxBlogrollPosts'] = 3; and read it in through the main For loop in Twig for index.html. It would only work for the main webpage so it served the desired effect. Since the pages are date-ordered in that theme it worked itself out, but generating multiple pages for navigation may be the solution for your site @james2doyle .

In the same 'blog' mentailty I opted for adding a /Years folder, where I made one template for any .md that had a meta: Year. It looks for any pages that belong to the .md file's specific year and blogrolls them in.

If anyone is interested I can share the code but perhaps it's also useful to go for the plugin route. You can see what that looks like here: www.maxarturoas.tk (WIP)

james2doyle commented 10 years ago

I'm starting work on a plugin.

STOWouters commented 9 years ago

I'm starting work on a plugin.

Oh well.. I'm glad that there was actually a pagination issue

@james2doyle I just published an actual pagination plugin: Phile Paginator . It works really fine on both Apache and Nginx (remote uses nginx and local is Apache2). :smiley:

I'm not sure if we can integrate some of the ideas from this plugin in the core? I'm also fine if we leave it as a plugin extension (e.g. some people doesn't want pagination at all).