tags:

views:

30

answers:

2

I want to make a posting comment script that satisfies a limited page size,i.e the page doesn't stretch with the creasing comments,so i want to make a limited number of comment per page and after exceeding this number the comment is added in a new page,but the comments should be in a speciefic blockin the page so turning the comment page occurs inside that block and doesn't affect the whole page. How can i apply that??

An example>>the comments in that page: http://thepiratebay.org/torrent/5840407/Get_Him_to_the_Greek_%282010%29_DVDRip_XviD-MAX

A: 

I'm not sure what your backend is, but here is an example: http://www.9lessons.info/2009/06/comment-system-with-jquery-ajax-and-php.html See the demo.

Tudorizer
thanks dear,i'll check it and tell you if i had questions
OdO
look,i don't know enough about jquery,so i need more simple script written directly in JS without frameworks.
OdO
A: 

By the looks of your tags ("ajax") you already have a general idea of how to start off.

High level overview:

  • limit your result set to a X items per page, eg SELECT * FROM comments LIMIT 0, 50 to get 50 comments
  • create a pager under your results listing (links to the other pages 1..2..3..) based on how many comments you have in total
  • add an onlick event to each of those page links that will do an ajax call to a backend script to get the results for that page (eg for page 2 it should fetch the results for SELECT * FROM comments LIMIT 50, 50
  • replace the results html with the new results

There is plenty of material in stackoverflow to get you started, and if you get stuck at a specific aspect of it by all means ask about it.

Fanis
OdO
Yes, you should also do a `SELECT count(*) FROM comments` to get the total number of comments. Then you can divide them into pages. http://stackoverflow.com/questions/2280230/searching-for-advanced-php-mysql-pagination-script might help with the logc
Fanis