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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

facebook plugin with comment ability


Go to End


4 Posts   1535 Views

Avatar
lozhowlett

Community Member, 151 Posts

30 September 2011 at 4:08am

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?

cheers

Avatar
zenmonkey

Community Member, 545 Posts

30 September 2011 at 4:14am

Simplest way is to use the Facebook plugin

https://developers.facebook.com/docs/reference/plugins/comments/

All of the FB social plugins can be found here

https://developers.facebook.com/docs/plugins/

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

Avatar
lozhowlett

Community Member, 151 Posts

30 September 2011 at 4:17am

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); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-comments" data-href="example.com" data-num-posts="2" data-width="500"></div>

...how would i get the current URL to replace "example.com" from silverstripe within my template .ss file? I am unsure where to look in to SS documentation!

cheers

Avatar
zenmonkey

Community Member, 545 Posts

30 September 2011 at 4:30am

Edited: 30/09/2011 4:31am

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

EDIT
here is a link to build in page controls. Useful :)
http://doc.silverstripe.org/sapphire/en/reference/built-in-page-controls