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 »

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: 9907
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: Infinite posts feature / option

Post by Oliver Georgi »

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 | Систрон
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Infinite posts feature / option

Post by update »

It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
nameless1
Posts: 880
Joined: Sun 27. Apr 2008, 23:22

Re: Infinite posts feature / option

Post by nameless1 »

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: 9907
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: Infinite posts feature / option

Post by Oliver Georgi »

Do not link to Google Code — GitHub has it too:
https://github.com/slackero/phpwcms/com ... 66cd062335
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
nameless1
Posts: 880
Joined: Sun 27. Apr 2008, 23:22

Re: Infinite posts feature / option

Post by nameless1 »

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

Re: Infinite posts feature / option

Post by update »

nameless1 wrote:would like to see the result.
Me too :)
and the corresponding howto ;)
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
User avatar
adamderesz
Posts: 19
Joined: Sat 3. Oct 2009, 14:06
Location: Gdansk / Poland
Contact:

Re: Infinite posts feature / option

Post by adamderesz »

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: 9907
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: Infinite posts feature / option

Post by Oliver Georgi »

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 | Систрон
User avatar
adamderesz
Posts: 19
Joined: Sat 3. Oct 2009, 14:06
Location: Gdansk / Poland
Contact:

Re: Infinite posts feature / option

Post by adamderesz »

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: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Infinite posts feature / option

Post by update »

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 maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
User avatar
Oliver Georgi
Site Admin
Posts: 9907
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: Infinite posts feature / option

Post by Oliver Georgi »

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 | Систрон
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Infinite posts feature / option

Post by update »

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 maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
User avatar
adamderesz
Posts: 19
Joined: Sat 3. Oct 2009, 14:06
Location: Gdansk / Poland
Contact:

Re: Infinite posts feature / option

Post by adamderesz »

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: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Infinite posts feature / option

Post by update »

It's now part of the wiki
Thanks! :)
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Post Reply