0

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

Ahmed Waheed
  • 1,281
  • 5
  • 21
  • 39

2 Answers2

1

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.

Tudor
  • 4,137
  • 5
  • 38
  • 54
0

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 Hatzidakis
  • 5,282
  • 1
  • 33
  • 36
  • i didn't get this point :create a pager under your results listing (links to the other pages 1..2..3..) based on how many comments you have in total ,,,how to make this pager&&do you mean that i should know the comments number previously by saying"based on how many comments you have in total"?? – Ahmed Waheed Oct 13 '10 at 19:49
  • 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 Hatzidakis Oct 13 '10 at 19:56