[Solution] Limit Comments in Story page.

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-30-2008, 08:37 PM
Constant Pligger
Pligg Version: 9.9.0
Pligg Template: yget
 
Join Date: Jan 2008
Posts: 159
I was digging around and I believe I got without bugs..

in 9.9 You need to find and open up story.php in the root folder.

Onces opened find and locate.
Code:
// get all parent comments
	$comments = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_link_id=$link->id and comment_parent = 0 ORDER BY " . $CommentOrderBy);
ADD This

Code:
// get all parent comments
	$comments = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_link_id=$link->id and comment_parent = 0 ORDER BY " . $CommentOrderBy . "  LIMIT 5;");
That should do the trick change the number to whatever is the amount you want to display.


Then you might want to do the same with replys to comments so if you do..

find

Code:
// get all child comments
			$comments2 = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_parent=$comment_id ORDER BY " . $CommentOrderBy);
and the same as above

Code:
// get all child comments
			$comments2 = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_parent=$comment_id ORDER BY " . $CommentOrderBy . "  LIMIT 5;");
As I said before here u can do whatever Number to Display certain number of comments...

I hope this helps..

Goog Luck..
Reply With Quote
  #2 (permalink)  
Old 01-31-2008, 04:41 AM
New Pligger
Pligg Version: 9.9
Pligg Template: Default
 
Join Date: Jan 2008
Posts: 13
Cool solution, couple of qustions, will this work with plig 9.6, and have you any idea how to implement it so that it shows 5 comments initially and when you click on a "show me all comments link it displays all comments"
Regards
Mike
Reply With Quote
  #3 (permalink)  
Old 01-31-2008, 06:13 AM
New Pligger
Pligg Version: 9.9
Pligg Template: Default
 
Join Date: Jan 2008
Posts: 13
Actually I am wondering is it possible to have pagination on the comments and display 5 at a time?
Reply With Quote
  #4 (permalink)  
Old 01-31-2008, 10:07 AM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 796
I dont think that solution will provide the pagination that will be needed. I think all that is going to do is echo the first 5 comments and thats it.

We need to input the smarty for pagination in there somewhere.

I could be wrong. Will poke around.

Thanks for submitting.

Geoserv.
Reply With Quote
  #5 (permalink)  
Old 01-31-2008, 12:16 PM
Constant Pligger
Pligg Version: 9.9.0
Pligg Template: yget
 
Join Date: Jan 2008
Posts: 159
yeap correct I did not test it with pagination..
Reply With Quote
  #6 (permalink)  
Old 01-31-2008, 06:32 PM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,042
Any pagination experts around?

P.S.: This should be part of the next release as a admin variable! A next step could be some kind of stop flag set by an admin to terminate comments individually per story.

Last edited by tbones; 01-31-2008 at 06:42 PM.
Reply With Quote
  #7 (permalink)  
Old 01-31-2008, 07:03 PM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 796
This will call the pagination:

Quote:
do_pages($rows, $page_size, "published");
I think the red part should be changed to "story" and not "published".

I haven't looked at the overall code that was provided above to see where to put this, but will later.

Geoserv.
Reply With Quote
  #8 (permalink)  
Old 01-31-2008, 08:19 PM
Constant Pligger
Pligg Version: 9.9.0
Pligg Template: yget
 
Join Date: Jan 2008
Posts: 159
Quote:
Originally Posted by tbones View Post
Any pagination experts around?

P.S.: This should be part of the next release as a admin variable! A next step could be some kind of stop flag set by an admin to terminate comments individually per story.
If you set it up as above?

Did u try pagination to see if its done correctly?
Reply With Quote
  #9 (permalink)  
Old 02-01-2008, 09:33 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,042
Quote:
Originally Posted by tbones View Post
Any pagination experts around?

P.S.: This should be part of the next release as a admin variable! A next step could be some kind of stop flag set by an admin to terminate comments individually per story.
This was a blind post before testing, sorry. I don´t have enough comments so far to test pagination.

I discovered one side effect: Since it´s just a selection you can add new comments that appear at newest comments. But they aren´t readable since these links use story.php ,too. :-)


P.S.: manya1011, could you maybe help me to modify the SQL queries for this change (http://forums.pligg.com/pligg-tutori...html#post54557, just this post) ?
Reply With Quote
  #10 (permalink)  
Old 03-12-2008, 06:26 PM
fhelik's Avatar
New Pligger
Pligg Version: 9.82
Pligg Template: jget
 
Join Date: Dec 2007
Location: Boston
Posts: 26
any one manage to make paginations comments?
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change page title only for story page - Google hadock Questions and Comments 12 11-23-2008 07:29 AM
how to completely REMOVE links from the title in the full story page? VictorML Questions and Comments 5 09-18-2008 09:26 AM
Page Variables Yankidank Wiki Articles 1 08-13-2008 03:59 AM
How to direct story title in summary page to the original story? chris79 Questions and Comments 4 02-03-2008 07:28 PM
Limiting comments on the story page. Darksat Questions and Comments 2 01-30-2008 08:37 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development