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’));
[removed]
<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
<?php
class Fb_comments extends CI_Controller
{
    function __construct()
    {
    parent::__construct();     
    }

    function index()
    {
  $this->load->view(‘fb_comments’);
    }
}   

 
Posted: 26 April 2012 02:16 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
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>
[removed]
  window
.fbAsyncInit = function() {
    FB
.init({
      appId      
'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
  (function(d){
     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);
   }(document));
[removed]

[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