N
N
nano_e_t_42016-08-31 12:40:02
Flask
nano_e_t_4, 2016-08-31 12:40:02

How to pass the current iteration?

Hello everyone
Maybe someone will say, I’ve come across:
I’m writing a website, I just can’t think of the right system of comments (I need a native one, third-party ones don’t fit for many reasons)
and the problem is this: when a user enters a page, he sees only 3 comments to article. If there are more of them in the database, the next button is displayed. When you click on it, the next 3 are displayed and the back button appears. Clicking next again shows the next 3, clicking back shows the previous three, and so on. When the last 3 comments are displayed, the next button disappears
The problem is that I can’t think of a beautiful solution how to transfer the current iteration to the server in order to send the current 3 comments
Look, help with advice
Thanks

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
chupasaurus, 2016-08-31
@chupasaurus

scheme://some.site/page#commentspage=100500 , no?

A
Artem, 2016-08-31
@Cruper

Add some js.
On the client, using js, remember the ID of the last comment. And when you need to load the next 3, pass the ID of the last comment on the page to the server.

A
Alexander, 2016-09-01
@bIbI4k0

In the "next" and "back" links, add the GET parameter offset, an indent that is a multiple of 3.
On the server, you get the necessary portion of comments with a query like SELECT * FROM comments LIMIT offse, 3;
For the first three comments, offset will be 0,
for the next 3.. Then, 6, 9, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question