Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

facebook plugin with comment ability


4 Posts   912 Views


30 September 2011 at 4:08am Community Member, 146 Posts

Hi everyone

Where can I get hold of some code to "plug" facebook comment box into my page and let people comment directly on my page using their facebook account... i have seen it on loads of sites, but not sure where to start?



30 September 2011 at 4:14am Community Member, 528 Posts

Simplest way is to use the Facebook plugin

All of the FB social plugins can be found here

This won't make the comments searchable items in SilverStripe though


30 September 2011 at 4:17am Community Member, 146 Posts

cool! so...

<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); = id;
js.src = "//";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-comments" data-href="" data-num-posts="2" data-width="500"></div> would i get the current URL to replace "" from silverstripe within my template .ss file? I am unsure where to look in to SS documentation!



30 September 2011 at 4:30am (Last edited: 30 September 2011 4:31am), Community Member, 528 Posts

You need to use {$AbsoluteLink} but that will include the "http://" not sure if that causes a fail or not. Otherwise put "{$URLSegment}" to include the link to the specific page.

here is a link to build in page controls. Useful :)