Avatar

Infinite scroll (General)

by Auge ⌂, Wednesday, November 11, 2015, 09:57 (3087 days ago) @ Andy

Hello

Only for clarification: infinite scroll means only to load the first X threads or postings into the aggregation view of all threads and load the next X threads or postings when arriving at the bottom of the page?

IAS is just stating 'no more posts' when scrolling to the bottom of the screen because I presume that the variable $start is not updating. I can't get my head round how or where $result will update if the page is scrolled down to the bottom, and where the code should go in the template or in the .inc file.

If the variables $start and $result are PHP variables they can't be updated because the PHP script ist not working in this moment. It's work ended in the moment, when the page was delivered to the browser of the user.

Would you be able to shed any light on this please, or indeed have you thought about implementing an infinite scroll option in mlf?

In summary all I am trying to do is to select and load say 50 entries from the database, rather than having to select all of them every time. When users are flicking between boards it does make a big difference.

Ok, let's have a look into the tasks.

1. Load the first X threads/postings in case of the first request (as usual).

2. Check permanently for the position of the page inside the browser window with JavaScript. We have to know, when the viewport of the browser arrives at the (actual) bottom of the page.

3. Send a request for the next X threads/posting via Ajax/JavaScript to the server when arriving at the bottom of the page. Show a "I'm busy" message to signalise that something goes on until item 4 is done.

4. The request will be sent to a PHP script, wich itself sends a query to the database and sends the result back to the Ajax/JavaScript routine.

5. Take back the result of the request and generate the output into the HTML document with the JavaScript routine.

6. Back to item 2.

And, not to forget, load the overview page with normal behaviour, if JavaScript is deactivated or not available.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!


Complete thread:

 RSS Feed of thread