1 harris404 Jun 18, 2009 20:23
3 waltercruz Jun 19, 2009 02:38
There's a max connection time setting on mysql side.. Will try to remember this name.
4 yabba Jun 19, 2009 08:49
I had paged comments a tad ago, IIRC it was a smidge of a pita to get it all working
¥
5 harris404 Jun 19, 2009 09:39
I tried to upload a custom php.ini to Siteground and it didn't helped.
Went to their Knowledge base and found this about custom php.ini:
- some important PHP limits cannot be changed, for example memory_limit and max_execution_timeout. Setting different values than the administratively assigned will endanger the overall shared server performance.
http://kb.siteground.com/article/How_to_change_the_value_of_a_PHP_setting.html
Any other suggestions?
Thanks for helpping!
6 yabba Jun 19, 2009 10:06
If you don't mind your comments in reverse order and with no page links then you can just change the call in your skin :
$CommentList = & new CommentList( $Blog, "'comment','trackback','pingback'", array('published'), '', '', 'DESC', '', 20 );
Change the 20 to suit.
¥
7 sam2kb Jun 19, 2009 10:23
Any other suggestions?
- Wait for Yabba's paginated comments hack
- Switch to another hosting http://b2evolution.net/web-hosting/top-quality-best-webhosting.php
8 sam2kb Jun 19, 2009 10:24
I'm late, the hack is already here ;)
9 harris404 Jun 19, 2009 10:59
Yabba,
Just tested your hack and noticed that all comments from all the posts appeared on all posts together :P
Also not having links for older entries is almost the same thing of deleting the older comments... (i would also prefer to keep the comments in the "original" order, because the the "next comment" have relation with the "previous one" and it's weird to read a conversation in backwards
I do answer every comment on my blog, and my previous answers can help other users with same questions (thats why i want to keep older entries).
sam2kb, i'm with sg for 5 or 6 years, i already planned to move away from them (since they implemented inode limits hidden in the contract) but i still have almost one year prepaid, so i will only think about this in 2010 :P
But even if I change my webhosting company, i will get the same problems, maybe the "post comment limits" increase, but sooner or later, the same problem will happen again :(
thanks for helpping
10 yabba Jun 19, 2009 11:41
That'll teach me to paste code from a test file :P
$CommentList = & new CommentList( $Blog, "'comment','trackback','pingback'", array('published'), $Item->ID, '', 'DESC', '', 20 );
It won't help you with your paging though. Pretty sure the method I used won't work now ;)
¥
11 yabba Jun 19, 2009 12:12
See if this works for you :
global $DB;
$comments_per_page = 10;
$sql = 'SELECT COUNT( DISTINCT( comment_ID ) ) FROM T_comments WHERE comment_post_ID='.$Item->ID.' AND comment_status='.$DB->quote('published' );
$total_rows = $DB->get_var( $sql );
$cpage = param('cpage', 'integer' );
$start = ( $cpage ? $cpage - 1 : 0 ) * $comments_per_page;
$num_pages = ceil( $total_rows / $comments_per_page );
$CommentList = & new CommentList( NULL, "'comment'", array('published'), $Item->ID, '', 'ASC', '', $start.','.$comments_per_page );
if( $cpage > 1 )
{
echo '<a href="'.url_add_param( $Item->get_permanent_url(), 'cpage='.( $cpage-1 ) ).'">Previous</a>';
}
if( $num_pages > $cpage )
{
echo '<a href="'.url_add_param( $Item->get_permanent_url(), 'cpage='.( $cpage+1 ) ).'">Next</a>';
}
¥
12 harris404 Jun 19, 2009 13:35
Wow! Thankyou Yabba, works very nice and solves my load issues! :)
I tested it and worked fine, but with this modification, i noticed 3 small issues:
#1 If I'm at the post page (ex: http://linux.eduardosilva.eti.br/review_endian_firewall ), and click on "next" it will reload the first page again, but with the page counter ( http://linux.eduardosilva.eti.br/review_endian_firewall?cpage=1 ) and at this time the "Next" will work properly
#2 The comment number displayed on left side of the comment is reseted on every new page. For example:
On page 1 it will show the comments from 1 to 10 fine, but on page 2 it will show the comments from 11 to 20 but the displayed numbers will be frrom 1 to 10 again
Is there any way to fix this numbering? or if it gets very complicated, disabling is an option. (Template default glossyblue)
#3 (i can live with this issue, it's not that bad) I know that probably this issue is complicated to solve, so no need to worry about it, i'm just saying for letting you know. If you follow a link to a specific comment and the comment isn't in the first page (ex: http://linux.eduardosilva.eti.br/review_endian_firewall#c320 ), them the page will not load at the comment. (As I said before, i can live with this :P )
Thanks a lot for the effort!! it means a lot for my blog and for me :)
13 yabba Jun 19, 2009 14:01
1) change this bit :
$cpage = param('cpage', 'integer', 1 );
2) Where you spit out your comment numbers change it to
echo ++$start;
3) That'd be a tad of a bitch to sort out without overloading your sql again ;)
¥
14 harris404 Jun 19, 2009 15:21
1) Worked, Great! :)
2) I'm trying to find the correct place to put this, but i can't figure out where :oops:
I do believe that it is in this first line (the one that starts with li id). (but i'm probably wrong :P)
I tried to insert the echo ++$start; in the boddy of the comment and the numeration was correct, but still in the wrong place...
<!-- ========== START of a COMMENT/TB/PB ========== -->
<li id="comment-<?php $Comment->ID(); ?>" class="<?php echo $oddcomment; ?>"><?php $Comment->anchor() ?>
<?php
switch( $Comment->get( 'type' ) )
{
case 'comment': // Display a comment:
3) I can survive with this, so no problem at all :)
Thank you again!
15 yabba Jun 19, 2009 15:31
Ack, it's because your comments are in an <ol> you need to change the following bits
<ul class="commentlist">
<?php
/* This variable is for alternating comment background */
$oddcomment = 'alt';
/**
* @var Comment
*/
while( $Comment = & $CommentList->get_next() )
{ // Loop through comments:
?>
<!-- ========== START of a COMMENT/TB/PB ========== -->
<li id="comment-<?php $Comment->ID(); ?>" class="<?php echo $oddcomment; ?>"><?php echo ++$start; ?><?php $Comment->anchor() ?>
[....]
?>
<!-- ========== END of a COMMENT/TB/PB ========== -->
<?php
} // End of comment list loop.
?>
</ul><?php
You may also need to play with teh stylesheet if it does stuff like :
ol.commentlist{
[...]
}
¥
16 harris404 Jun 19, 2009 21:34
¥åßßå I was getting an error with the code that you sent to me, in some cases the $num_pages was lower than expected.
I didn't want to botter you again, so i went to google and learned a bit of php :lol:
The problem was with the round function, for values lower than .5
I replaced round for ceil and the problem was over.
$num_pages = round( $total_rows / $comments_per_page );
changed to:
$num_pages = ceil( $total_rows / $comments_per_page );
Besides this, just a few minor changes to next and previous buttons. If you or someone else wants the edited template file i can upload it to somewhere :)
Thank you very mutch for the help, it was very important :)
Also would like to thank to sam2kb and Walter.
I also made a post on my blog saying thanks and allowing my visitors know how dedicated are the b2evolution crew and comunnity.
17 waltercruz Jun 20, 2009 00:24
Yabs, should we add comment pagination to the core?
18 yabba Jun 20, 2009 08:08
harris404 wrote:
I replaced round for ceil and the problem was over.
Gotta love open source :D .. I've updated my original post to reflect the change
Walter wrote:
Yabs, should we add comment pagination to the core?
First you'd need to get #3 working ;)
harris404 wrote:
#3 (i can live with this issue, it's not that bad) I know that probably this issue is complicated to solve, so no need to worry about it, i'm just saying for letting you know. If you follow a link to a specific comment and the comment isn't in the first page (ex: http://linux.eduardosilva.eti.br/review_endian_firewall#c320 ), them the page will not load at the comment. (As I said before, i can live with this :P )
harris404 wrote:
I also made a post on my blog saying thanks and allowing my visitors know how dedicated are the b2evolution crew and comunnity.
Thanks for the credit :D
¥
Add the following to php.ini and see if it helps
memory_limit = 128M
max_execution_time = 300
max_input_time = 300