v4.0.x Facebook Comments integration

Discussion in 'Modules / Plugins / Modifications' started by SecondShoe, Nov 17, 2011.

  1. SecondShoe Customer

    v4.0.9 Developer

    Hi guys!
    I'm trying to integrate Facebook Comments to every single ad in my site. The problem is that I can't figure out what to write in "URL to comment on" field at https://developers.facebook.com/docs/reference/plugins/comments where the code is generated. I bet someone here knows what is the right URL format.
    10x in advance!
  2. Mike-N-Tosh Developer & Moderator

    That is not going to work for individual dynamic pages. The field in the form that you referred to is expecting a static url. The Facebook API isn't going to be able to parse variables on your site such as smarty variables. The URL that shows in your browser while viewing the individual listing page could be inserted in that form, but again, that is only going to be for that one page.

    In addition, this would be irrelevant on an individual listing page unless you are allowing posts to Facebook from and referring to that individual page as well.

    As a suggestion and I have done this on several client sites, is to use it in your layout.tpl main template in the side column. I've done this for either the clients Facebook page and comments as you are attempting to do here, except that it is for the site as a whole, not individual listing pages.

    Think your plan and plan your think
    1 people like this.
  3. SecondShoe Customer

    10x for the answer Mike-N-Tosh!

    I just found very simple solution to get the job done.
    Code:
    <script language="javascript" type="text/javascript">
    document.write("<div id='fb-root'></div><fb:comments href='"+ document.location.href +"'  num_posts='10' width='735'></fb:comments>");
    </script>
    <script src='http://connect.facebook.net/en_US/all.js#xfbml=1'></script>
    I added that code to my viewlisting.tpl and it actually works like a charm. Different comments for every single ad. I never thought it would be that simple.

Share This Page