Infinite posts feature / option

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
User avatar
adamderesz
Posts: 19
Joined: Sat 3. Oct 2009, 14:06
Location: Gdansk / Poland
Contact:

Infinite posts feature / option

Post by adamderesz » Thu 9. Jan 2014, 12:50

Is it possible to implement somehow the 'infinite posts' option so once we open a page/section it will automatically load few articles and add more articles from that category every time we reach almost end of that page?
That would be very very useful

User avatar
Oliver Georgi
Site Admin
Posts: 9457
Joined: Fri 3. Oct 2003, 22:22
Location: Dessau
Contact:

Re: Infinite posts feature / option

Post by Oliver Georgi » Thu 9. Jan 2014, 12:57

until now there is nothing like this. It might be possible in combination with pagination and javascript that handles this because there is simple solution inside of phpwcms to catch only specific content sections. Idea would be to detect pagination by javascript, sort out the possible max amount and while scrolling down load next page content by ajax and append it and so on…

All missing is the JavaScript that is fired — at all pretty simple. No JavaScript = fallback to the classic paginated method.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Kleintierpraxis am Georgengarten

User avatar
update
Moderator
Posts: 6372
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Infinite posts feature / option

Post by update » Thu 9. Jan 2014, 13:23

It's mostly all about webdesign, logo design, new and old pages refresh, print BUT slowly switching to be supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.

nameless1
Posts: 847
Joined: Sun 27. Apr 2008, 23:22

Re: Infinite posts feature / option

Post by nameless1 » Thu 9. Jan 2014, 13:44

in conclusion, adamderesz: if you're able to output a pagination you're able to infinit scroll
but there are only a few parts inside phpwcms with pagination, yet

other way oliver talked about would be to check this and create your own infinit loader.

would like to see the result.
Last edited by nameless1 on Thu 9. Jan 2014, 18:21, edited 1 time in total.

User avatar
Oliver Georgi
Site Admin
Posts: 9457
Joined: Fri 3. Oct 2003, 22:22
Location: Dessau
Contact:

Re: Infinite posts feature / option

Post by Oliver Georgi » Thu 9. Jan 2014, 14:01

Do not link to Google Code — GitHub has it too:
https://github.com/slackero/phpwcms/com ... 66cd062335
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Kleintierpraxis am Georgengarten

nameless1
Posts: 847
Joined: Sun 27. Apr 2008, 23:22

Re: Infinite posts feature / option

Post by nameless1 » Thu 9. Jan 2014, 18:20

changed

User avatar
update
Moderator
Posts: 6372
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Infinite posts feature / option

Post by update » Thu 9. Jan 2014, 18:59

nameless1 wrote:would like to see the result.
Me too :)
and the corresponding howto ;)
It's mostly all about webdesign, logo design, new and old pages refresh, print BUT slowly switching to be supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.

User avatar
adamderesz
Posts: 19
Joined: Sat 3. Oct 2009, 14:06
Location: Gdansk / Poland
Contact:

Re: Infinite posts feature / option

Post by adamderesz » Fri 10. Jan 2014, 18:18

Will have a think about it... slight trouble is I'm not the best javascripter in town :D

To tell you the truth I recently had to make a website based on 'wp' and it was so incredibly painful I regretted this job the second day it started...
Mmy customer needed to use a tool that's based on.. that something, so there was no other option. Hopefully for me it was also based on purchased template, so at the end it was not so bad, but I'll never do it again if I'm not forced to it :)

To the point - the cool feature there was this infinite posts, and I really liked that idea... so, we'll see
thanks for info and some draft guidelines
Adam

User avatar
Oliver Georgi
Site Admin
Posts: 9457
Joined: Fri 3. Oct 2003, 22:22
Location: Dessau
Contact:

Re: Infinite posts feature / option

Post by Oliver Georgi » Fri 10. Jan 2014, 19:18

I would be able to work this out if someone needs but as always — should be paid at all (symbolic price).
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Kleintierpraxis am Georgengarten

User avatar
adamderesz
Posts: 19
Joined: Sat 3. Oct 2009, 14:06
Location: Gdansk / Poland
Contact:

Re: Infinite posts feature / option

Post by adamderesz » Sat 11. Jan 2014, 11:40

Soo, tried it on phpwcms 1.5.4.1 (r491), and it worked (in general) straight from the box.
Code used was Infinite Ajax Scroll (IAS) from https://github.com/webcreate/infinite-ajax-scroll

Here's how it went:
1.
Site is using paginate code as in config/phpwcms/conf.template_default.inc.php file with added extra class for "next page' link as it's required by the IAS script to work

Code: Select all

Line 122:
$template_default['article_paginate_navi']	= '<div class="paginate paginate-{POS}">{PREV:&laquo;} <span class="page-next">{NEXT:&raquo;}</span> page # of ##</div>'; //
2.
I have the 'articles' template set, that is different to all others within the site for various reasons, and it includes jQuery (v1.7), the IAS script and then call to start IAS.
Theres' some small css provided with IAS I just placed together with my main css file. It's just to position the loading progress graphic, mainly and make nice notes (IAS script can add notes like 'no more to view' or 'hover here for more content') - I don't use that here.
The call for that lot is also straight from the box:

Code: Select all

<script type="text/javascript">
jQuery.ias({
    container : '#cnt',
    item: '.artlistentry',    
    pagination: '#cnt .paginate',
    next: '.page-next a',
    loader: '<img src="/img/loader.gif"/>'
});
</script>
Above call (if in-page) shall be placed after the posts area so it hides the original pagination block, if it's before - the block will be visible until first ias function trigger.

3.
Set up the article nodes of my site to use pagination and show 5 elements per page...
And it works like a gem :)

I'm quite sure it will work as good if used for article content pagination... so one can do a fancy self expanding article with just few clicks, literally.

I guess that could be a nice feature to implement, sometime in a future or just setup guidelines somewhere in official phpwcms docs

User avatar
update
Moderator
Posts: 6372
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Infinite posts feature / option

Post by update » Sat 11. Jan 2014, 12:00

Yeah! This sounds good (enough) to give it a try? :)
Will post it at the http://www.phpwcms-howto.de/wiki/ as soon as there is some more comment by Oliver to read... ;)
It's mostly all about webdesign, logo design, new and old pages refresh, print BUT slowly switching to be supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.

User avatar
Oliver Georgi
Site Admin
Posts: 9457
Joined: Fri 3. Oct 2003, 22:22
Location: Dessau
Contact:

Re: Infinite posts feature / option

Post by Oliver Georgi » Sat 11. Jan 2014, 12:13

adamderesz wrote:Soo, tried it on phpwcms 1.5.4.1 (r491), and it worked (in general) straight from the box…
Fine and good work. That's easy at all.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Kleintierpraxis am Georgengarten

User avatar
update
Moderator
Posts: 6372
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Infinite posts feature / option

Post by update » Sat 11. Jan 2014, 12:33

adamderesz wrote: 3.
Set up the article nodes of my site to use pagination and show 5 elements per page...
adamderesz wrote: I have the 'articles' template set, that is different to all others
Could you please be so kind to provide examples of the above, for the sake of completeness? :)
Edit: Did you setup different articles within a level or did you use the pagination of Content Parts? Could be done with both versions, I think?
It's mostly all about webdesign, logo design, new and old pages refresh, print BUT slowly switching to be supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.

User avatar
adamderesz
Posts: 19
Joined: Sat 3. Oct 2009, 14:06
Location: Gdansk / Poland
Contact:

Re: Infinite posts feature / option

Post by adamderesz » Sat 11. Jan 2014, 14:02

claus wrote: Could you please be so kind to provide examples of the above, for the sake of completeness? :)
There's nothing to add, really.
In administration, for sections that have many articles (news, events, blog name it any way you want) one must enable pagination and set it to required number of elements per page.
My 'articles template' is different only because it implements the IAS code plus {CATEGORY} as a h1 element (instead of using the regular article h1). That's because I also use additional 'news' article template - purely to have other headers formatting - different for single page and multi-articles section. It's really very site specific, so there's nothing to add to 'core instruction' ;)
claus wrote: Edit: Did you setup different articles within a level or did you use the pagination of Content Parts? Could be done with both versions, I think?
The test implementation I made - it's actually live client's site ( :twisted: ) - is using that for article list, only - as this is the place where pagination is used most often. They rarely have articles that long to make them self-expanding, but lists of entries is a whole other thing.

I believe it could be implemented for ContentParts pagination - when it's set with the nextpage/prevpage options. It's just so it has 'findable' next button - with special class or ID, so we can tell the IAS script what to look for.
As regards howto - it's just to figure out where it's the best to include necessary JS. In my opinion it would be the 'paginate version' of standard article template... I would not mess with other places for sake of general code 'purity'.

User avatar
update
Moderator
Posts: 6372
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Infinite posts feature / option

Post by update » Sat 11. Jan 2014, 14:21

It's now part of the wiki
Thanks! :)
It's mostly all about webdesign, logo design, new and old pages refresh, print BUT slowly switching to be supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.

Post Reply