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&width=249&connections=8&stream=false&header=true&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.
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
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?
(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.
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)
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?
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?
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&width=249&connections=8&stream=false&header=true&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.
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.
(Profile id changed and FB.init, but that may be generic)
Rich
Hi Rich,
And are you adding this code directly to a content page or to a macro?
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
Have you confirmed it works as HTML as putting it in a template or macro really shouldn't cause any issues?
Rich
For us XSLT challenged can you post your xslt?
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
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
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....
"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.
(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.
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
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)
Add the following line
xmlns:fb="urn:facebook.com:xslt"
under this line in your XSLT file
Rich
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?
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
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.
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?
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
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?
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
Rich, you have cleared up many questions for me and I already got some ideas for dealing with this plugin. Many thanks!
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(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>
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?
Please help to prior question
is working on a reply...