Recent Topics

1 Jun 18, 2009 20:23    

My b2evolution Version: 2.x

Since my last post asking for a way of paginating comments was locked because it was a "duplicated post" i would like to ask for help with a small issue.

I do have some posts with lots of comments,

One of those posts have more than 100+ comments today i recieved 2 or 3 new comments to this post and now i cannot even load the complete post/comments

Is there any solution for this instead of "deleting old comments"?

Those are the error messages that appear instead of comments beyond 90+

Informações adicionais sobre esse erro:

MySQL error!

MySQL server has gone away(Errno=2006)

Your query: DataObjectCache::get_by_ID()

SELECT *

FROM evo_users

WHERE user_ID = 9

Um erro inesperado ocorreu!

Se esse erro persistir, por favor informe isto ao administrador.

Voltar para a página inicial.
Informações adicionais sobre esse erro:

MySQL error!

MySQL server has gone away(Errno=2006)

Your query: Session::dbsave()

UPDATE evo_sessions SET
sess_data = 'a:1:{s:22:\"ItemList_filters_coll3\";a:2:{i:0;N;i:1;a:30:{s:13:\"filter_preset\";N;s:6:\"ts_min\";N;s:6:\"ts_max\";N;s:14:\"ts_created_max\";N;s:9:\"cat_array\";a:0:{}s:12:\"cat_modifier\";s:0:\"\";s:9:\"cat_focus\";s:4:\"wide\";s:4:\"tags\";N;s:7:\"authors\";N;s:9:\"assignees\";N;s:15:\"author_assignee\";N;s:2:\"lc\";s:3:\"all\";s:8:\"keywords\";N;s:6:\"phrase\";s:3:\"AND\";s:5:\"exact\";i:0;s:7:\"post_ID\";N;s:12:\"post_ID_list\";N;s:10:\"post_title\";N;s:6:\"ymdhms\";N;s:4:\"week\";N;s:10:\"ymdhms_min\";s:0:\"\";s:10:\"ymdhms_max\";s:0:\"\";s:8:\"statuses\";N;s:5:\"types\";N;s:16:\"visibility_array\";a:6:{i:0;s:9:\"published\";i:1;s:9:\"protected\";i:2;s:7:\"private\";i:3;s:5:\"draft\";i:4;s:10:\"deprecated\";i:5;s:10:\"redirected\";}s:7:\"orderby\";s:9:\"datestart\";s:5:\"order\";s:4:\"DESC\";s:4:\"unit\";s:5:\"posts\";s:5:\"posts\";i:20;s:4:\"page\";i:1;}}}',
sess_ipaddress = '41.223.125.254',
sess_key = 'NLYVOQIvNV6QLkkiywQdUfGCSrYFYjnS',
sess_lastseen = '2009-06-18 15:04:16',
sess_user_ID = 3

WHERE sess_ID = 51095

(There is some portuguese text in the middle of the message, i think that this is because of the translation)
I do believe that i'm using too many resources on the server.

edit: sometimes it load completelly, sometimes it dies in the middle

Any ideas or suggestions?

2 Jun 18, 2009 20:35

Add the following to php.ini and see if it helps

memory_limit = 128M
max_execution_time = 300
max_input_time = 300

3 Jun 19, 2009 02:38

There's a max connection time setting on mysql side.. Will try to remember this name.

4 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 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 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.

¥

8 Jun 19, 2009 10:24

I'm late, the hack is already here ;)

9 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 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 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 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 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 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 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 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.

http://linux.eduardosilva.eti.br/b2evolution

17 Jun 20, 2009 00:24

Yabs, should we add comment pagination to the core?

18 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.

http://linux.eduardosilva.eti.br/b2evolution

Thanks for the credit :D

¥


Form is loading...