Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Erik Ernst 70 posts 90 karma points
    Sep 20, 2010 @ 15:13
    Erik Ernst
    0

    Adding Facebook Like-Box to Umbraco

    I have tried to add the Facebook Like-Box to Umbraco (described here: http://developers.facebook.com/docs/reference/plugins/like-box) but I cannot get it to work.

    I have tried to add the IFRAME tag (<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FDynamics-Experts%2F101041945979%3Fref%3Dts&amp;width=249&amp;connections=8&amp;stream=false&amp;header=true&amp;height=287" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:249px; height:287px;" allowTransparency="true"></iframe>) directly to the HTML part of the page and to create a new macro where the IFRAME tage is the only direct content and then add the macro to the content page directly. But neither works.

  • Rich Green 2246 posts 4008 karma points
    Sep 20, 2010 @ 15:34
    Rich Green
    0

    Should work no problem, have you tried your code on a static html page?

    I have this working with slightly different embed code by using a macro.

    <script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US"></script><script type="text/javascript">FB.init("xxx");</script> 
    <fb:fan profile_id="xxx" stream="1" connections="10" logobar="0" width="300" height="600"></fb:fan> 

    (Profile id changed and FB.init, but that may be generic)

    Rich

  • Erik Ernst 70 posts 90 karma points
    Sep 20, 2010 @ 15:59
    Erik Ernst
    0

    Hi Rich,

    And are you adding this code directly to a content page or to a macro?

  • Rich Green 2246 posts 4008 karma points
    Sep 20, 2010 @ 16:11
    Rich Green
    0

    Both, it works within a template and also I have it in a Textbox Multiple field which gets rendered out with a macro using something like this

     <xsl:value-of select="$module/data [@alias = 'embedCodeMPU']"  disable-output-escaping="yes"/>

    Have you confirmed it works as HTML as putting it in a template or macro really shouldn't cause any issues?

    Rich

     

     

  • Nick Portelli 76 posts 102 karma points
    Oct 06, 2010 @ 02:47
    Nick Portelli
    0

    For us XSLT challenged can you post your xslt?

  • Rich Green 2246 posts 4008 karma points
    Oct 06, 2010 @ 09:23
    Rich Green
    0

    Hi Nick,

    That is my XSLT above!  Though it's probably not need in this case, you can put the facebook code directly into your template.

    The reason I have it in XSLT is because I'm using the same functionality to embed video/facebook/images etc. and the user can tweak the embded code for each.

    Unless you need this you can just:

    Create a clean XSLT file named "FaceBook" (keep the box to create a macro ticked)

    Paste in the following code (change everything that says xxx to your profile id),  or better still get the embed code direct from your Facebook account

    <script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US"></script><script type="text/javascript">FB.init("xxx");</script> 
    <fb:fan profile_id="xxx" stream="1" connections="10" logobar="0" width="300" height="600"></fb:fan> 

    If you want to use this in the RTE then tick the "Use in editor" checkbox, otherwise just use the Macro directly in your template.

    Hope that makes sense

    Rich

  • Nick Portelli 76 posts 102 karma points
    Oct 06, 2010 @ 17:39
    Nick Portelli
    0

    Yes I was trying this for my blog.  I wanted a macro that would insert a FB like button to the post...I suppose I could put in the post template.  Anyway I saw the addthis project here for Umbraco...and tried to edit the xslt it created to use different code in the template.  It has similar fb:fan type of syntax calls.  When I try and save the xslt it blows up on the ":". 

    On a side note I added some script to my main template that loads the Facebook js to be able to use the fb:fan stuff....is that the <script> in your post?

     

    EDIT:

    NM I still have AppId'your app id' as my id....

  • Aming 23 posts 43 karma points
    Oct 20, 2010 @ 04:47
    Aming
    0

    "Should work no problem, have you tried your code on a static html page?

    I have this working with slightly different embed code by using a macro.

    <script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US"></script><script type="text/javascript">FB.init("xxx");</script> 
    <fb:fan profile_id="xxx" stream="1" connections="10" logobar="0" width="300" height="600"></fb:fan>

    (Profile id changed and FB.init, but that may be generic)

    Rich"

    I put this code into the master page and it works very well, but the only problem is that the facebook plugin will refresh every time when navigation. Is there anything I can do to solve this problem? Thanks.

  • Rich Green 2246 posts 4008 karma points
    Oct 20, 2010 @ 10:23
    Rich Green
    0

    Hi,

    If you put this code within a macro then you could possibly cache the macro, not 100% this will work so you'd need to check.

    Rich

  • Aming 23 posts 43 karma points
    Oct 20, 2010 @ 15:28
    Aming
    0

    Thanks for your reply, but when I tried to put the code into xslt, I got the following error. Do you know the reason? 

    System.Xml.XmlException: 'fb' is an undeclared namespace. Line 19, position 2. 
    at System.Xml.XmlTextReaderImpl.Throw(Exception e) 
    at System.Xml.XmlTextReaderImpl.LookupNamespace(NodeData node) 
    at System.Xml.XmlTextReaderImpl.ElementNamespaceLookup() 
    at System.Xml.XmlTextReaderImpl.ParseAttributes() 
    at System.Xml.XmlTextReaderImpl.ParseElement() 
    at System.Xml.XmlTextReaderImpl.ParseElementContent() 
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper() 
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling() 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags) 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl stylesheetNsList) 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet() 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)

  • Rich Green 2246 posts 4008 karma points
    Oct 20, 2010 @ 15:39
    Rich Green
    0

    Add the following line

    xmlns:fb="urn:facebook.com:xslt"

    under this line in your XSLT file

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

    Rich

  • Aming 23 posts 43 karma points
    Oct 20, 2010 @ 16:06
    Aming
    0

    The error disappeared but the Facebook plugin still refresh every time. I installed Blog4Umbraco and the Facebook macro is put into sidebar of the master page. The html body of the master page is wrapped by a <Form> tag in Blog4Umbraco. Could it be the reason of refreshing every time?

  • Rich Green 2246 posts 4008 karma points
    Oct 20, 2010 @ 16:07
    Rich Green
    0

    Did you cache the macro?

    Of course the page will refresh when you move around but the content from the facebook macro can be cached as long as you like.

    Rich

  • Aming 23 posts 43 karma points
    Oct 20, 2010 @ 16:22
    Aming
    0

    Did you mean whether I checked the box of Cache By Page? Yes, I checked the box.

    Also, after putting the code into a macro, the Facebook plugin window can show up in Chrome browser but can not show up in IE8 browser.

  • Aming 23 posts 43 karma points
    Oct 20, 2010 @ 16:30
    Aming
    0

    Is there any method to let the Facebook plugin refresh only the first time launching the page, then keep it still until the browser is closed? 

  • Rich Green 2246 posts 4008 karma points
    Oct 20, 2010 @ 16:33
    Rich Green
    0

    Did you change the cache period (number of seconds)?

    To get the Facebook plugin to display just once, you'd probably need to use old school frames.

    However caching the macro should have the same effect.

    Rich

  • Aming 23 posts 43 karma points
    Oct 20, 2010 @ 17:06
    Aming
    0

    Yes, I tried to put 100 seconds to the cache period but it doesn't work. I am curious about this facebook plugin used in your website. Do it not refresh every time when you move around?

  • Rich Green 2246 posts 4008 karma points
    Oct 20, 2010 @ 17:10
    Rich Green
    0

    Mine is only on the home page, so yes it refreshes every time but it doesn't matter.

    The only way I know for you to solve it to use a frame (!) or to use some different code.

    I'm guessing it's supposed to refresh as it loads different friends each time.

    Sorry I couldn't be further help.

    Rich

     

  • Aming 23 posts 43 karma points
    Oct 20, 2010 @ 17:23
    Aming
    0

    Rich, you have cleared up many questions for me and I already got some ideas for dealing with this plugin. Many thanks!

  • Maritza 29 posts 49 karma points
    Jun 05, 2013 @ 21:45
    Maritza
    0

    Hi I got my facebook botton to work - but now the page content desappear 

    can some one tell me what I'm doing wrong?

     

    I have the main code on my template:

     

        <div id="fb-root">div>
    <script>(function(dsid{
      var jsfjs 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(jsfjs);
    }(document'script''facebook-jssdk'));script

     

    then on the sxlt for the micro I have:

    xmlns:fb="urn:facebook.com:xslt"

    <fb:like href="http://xxxxxxxxxxxxx" send="true" width="450" show_faces="true">fb:like>

     

    then I insert the macro on my page

     

    Any advise?

  • Maritza 29 posts 49 karma points
    Jun 06, 2013 @ 15:08
    Maritza
    0

    Please help to prior question

     

Please Sign in or register to post replies

Write your reply to:

Draft