EllisLab text mark
Advanced Search
facebook comment box error in codeigniter
Posted: 26 April 2012 03:48 AM
Joined: 2012-04-26
2 posts

Hi all,
I am trying to develop facebook comments application in my codeignitor project but i face problem like loading comment box and also not display all comment properly and when i use another fresh application codeigniter that work good.

I use this code in view file

[removed](function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=123456789123456";
fjs[removed].insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));
<div class=“fb-comments” data-href=“http://test.xyz.com:8080” data-num-posts=“100” numposts=“10” data-width=“800”></div>
I use this code in controllers file
class Fb_comments extends CI_Controller
function __construct()

    function index()

Posted: 26 April 2012 02:16 PM   [ # 1 ]   [ Rating: 0 ]
Joined: 2012-04-19
13 posts

try to place the code facebook comment in your view.

place this code after tag <body>

<div id="fb-root"></div>
.fbAsyncInit = function() {
'234065836700636'// App ID mading.itt
channelUrl '<?php echo current_url()?>, // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML

    // Additional initialization code here

  // Load the SDK Asynchronously
     var js, id = '
facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('
script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref[removed].insertBefore(js, ref);

[removed](function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=234065836700636";
  fjs[removed].insertBefore(js, fjs);
}(document, '
script', 'facebook-jssdk'));[removed] 

and then,  paste this code :

<div class="fb-comments" data-href="localhost" data-num-posts="5" data-width="700"></div