fb_comment_id / facebook social plugin

Hi all,

I have introduced facebook social plugins ("like" box and "comment" box) in my yii-powered site.

They work good except for one thing.

A posted comment on the facebook wall produces a link like




"http://www.some.net/module/controller/action?fb_comment_id=fbc_10150347268911026_20588394_10150358772481026#f1c68af4df0c3f4".



And the query string part of "fb_comment_id" will cause some malfunction on my site.

What do you think the best solution to this problem?

OK, I think I’ve got it.

I’ve been using CHttpRequest::url to define the “data-href” attribute of the facebook plugins.




$pageUrl = Yii::app()->request->hostInfo .  . Yii::app()->request->url;

echo '<div class="fb-comments" data-href="' . $pageUrl . '" data-num-posts="4" data-width="550"></div>' . "\n";



And I’ve changed to:




$pageUrl = Yii::app()->request->hostInfo . Yii::app()->request->baseUrl . '/' . Yii::app()->request->pathInfo;

echo '<div class="fb-comments" data-href="' . $pageUrl . '" data-num-posts="4" data-width="550"></div>' . "\n";



As for now, it seems to work good. :)

Hi softark,

I also want to introduce a facebook comment plugin. Can you please help me with?

I am a beginner web developer.

Best Regards,

Vic

Hi, Nickelback,

I’ve just written a wiki about the subject. Please check it.

Simple Share Widget for Facebook, twitter and google+

how to count the number of comments ?