The facebook comment plug in is not working with smarty template. The code I am using is given below
<div id="fb-root"></div> {literal}<script src="http://connect.facebook.net/en_US/all.js#appId=APP_ID&xfbml=1"></script>{/literal} <fb:comments width="425"></fb:comments>
Please check this and let me know if there is any solution for this
Thanks In Advance
Rose
The issue is most likely because of the order in which this template loads on the page. You are most likely going to need to manually initialize the XFBML on your page for the tag to render. This is probably beyond what a template engine is going to be able to do. You are going to need to call FB.init(xfbml:true); after the template has loaded on the page. Also, change the script reference to
<script src="http://connect.facebook.net/en_US/all.js"></script>
The initilization call should occur only after the above script is loaded.
<script>
FB.init({xfbml:true});
</script?
Related
Working in Kentico 7 on an Ad-Hoc page that inherits from Portal Master. I want to insert some literal script or code right before the </body> tag in the rendered ad-hoc page.
I thought I'd have to do this by editing the portal master and adding the following:
<cms:CMSPagePlaceholder ID="plcBodyEnd" runat="server">
<LayoutTemplate>
</LayoutTemplate>
</cms:CMSPagePlaceholder>
and then in the layout of the Ad-Hoc page do this:
<cms:CMSContent runat="server" id="cntLeft" PagePlaceholderID="plcBodyEnd">
<script type="text/javascript">
ProviderConnections.Transparency.initializeWidget({ });
</script>
</cms:CMSContent>
This worked fine until I went to the design tab on the Ad-Hoc page, where I got the following error:
Object reference not set to an instance of an object.
I don't want to register script blocks. I just want to put text in the Ad-Hoc page that goes there before the </body> tag, which is controlled by Portal Master.
What am I doing wrong?
I'm not 100% sure what you are trying to achieve. Giving an example or attaching a screenshot would be very helpful.
Here are the ways of attaching JavaScript in Kentico:
Through portal engine:
Use JavaScript web part - that gives you an option of choosing where the script should be located
Programmatically from code-behind:
Use CMS.Helpers.ScriptHelper API (wrapper around ASP.NET's ClientScriptManager)
ScriptHelper.RegisterStartupScript() to put the script at the end of the page
ScriptHelper.RegisterClientScriptBlock() to put the script before page's elements
The difference between the two is well explained here.
Programmatically from ASPX markup:
Put your <script> block to a desired location in your .aspx / .ascx files
Evaluate a code-behind variable containing script
<asp:Button ID="btnOK" runat="server" Text="OK" />
<script type="text/javascript">
<%= fieldWithActualScript %>
</script>
In our CMS the developer added an "addthis.com" script which appends a hashtag and a tracking id to the browser address bar URL, for example http://www.site.com/about/#.UX6e2j7mK30
There is a solution how to get rid of this tracking but we are limited with CMS which only allows us to add javascripts to page header. The addthis script executes within page body and I need somehow to run the fix script after the default script has run. When I add the below script then the fix doesn't work. Is there any solution? Many thanks
<script type="text/javascript">
$(document).ready(function() {
var addthis_config = addthis_config||{};
addthis_config.data_track_addressbar = false;
});
</script>
Remove the $(document).ready and just declare addthis_config. Since this is just defining the configuration values for AddThis, there's no need to wait for the document to fully load. Because you're waiting for the document to load and then setting addthis_config, the AddThis code has already run and appended the addressbar tracking hash.
I use a script I got from the thread below, and adapted slightly
New Facebook like button HTML validation
however the channelurl doesn't work(lots of fd_fragment and multiple visits 10s apart) and I am not 100% convinced about the provenance or the effectiveness of the code, though it does leave me with valid xhtml,
I have tested the like function and it works for me, but I keep seeing "like" operations in my analytics that don't translate into visible "likes" from visitors
furthermore, I find no ref to "fbcont" in facebook literature
Sadly, javascript/ajax is not yet comfortable for me so i'm fumbling a bit here
Can anyone enlighten me about whats wrong with the code
Thanks
My Code:
<div id="FbCont">
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1" type="text/javascript">
</script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var fb = document.createElement('fb:like');
fb.setAttribute("href","http://www.mydomainname.com");
fb.setAttribute("send","true");
fb.setAttribute("action","like");
fb.setAttribute("layout","button_count");
fb.setAttribute("show_faces","true");
fb.setAttribute("width","100");
fb.setAttribute("font","");
fb.setAttribute("channelUrl","http://www.mydomainname.com/channel.html");
document.getElementById("FbCont").appendChild(fb);
//--><!]]>
</script>
</div>
My application has a homepage where you can download and install the plugins. It also uses site tags to call the same ruleset to show potential users what the app does.
I'd like to hide the plugins and replace that div with one that says 'Thanks for installing the plugin.' How can I tell the difference between KRL called from the site tags and KRL called from the plugin?
Here's my ideas, but perhaps there is a better way?
Option 1: Use page parameter, maybe the plugin won't see it.
Option 2: Use a second ruleset that calls into my primary ruleset. The plugin ruleset will hide the plugin div and unhide the 'thank you' div. I just have to have the primary ruleset support explicit events.
I think your best option is to use a page parameter, as you said. This will only be sent to the ruleset from your site tags--not from the browser extension--so that should solve your problem. Your site tags will look something like this:
<script type="text/javascript">
var KOBJ_config = {
"rids" : ["a999x99"]
"called_from_site_tags" : "true"
};
</script>
<script type="text/javascript" src="http://init.kobj.net/js/shared/kobj-static.js">
</script>
Then in your app you just have to check the page:param and do whatever you want with it:
is_site_tags = page:param("called_from_site_tags");
See here in the docs for more information. Hope that helps!
I have an iframe application which works fine but the issue comes when the content of iframe is large the text appears to be cut down.
I registered the application as iframe and set as resizable.
I have applied the following code but nothing seems to work
<div id="FB_HiddenIFrameContainer" style="display:none; position:absolute; left:-100px; top:-100px; width:0px; height: 0px;"></div>
<script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script type="text/javascript">
FB_RequireFeatures(["CanvasUtil"], function(){
FB.XdComm.Server.init(xd_receiver.htm);
FB.CanvasClient.setSizeToContent();
});
</script>
I have xd_receiver.htm file in myapp folder.
Please help me on this
In my iframe app I use
FB.CanvasClient.startTimerToSizeToContent();
instead of setSizeToContent() which seems to work for me.
Edit:
Can your javascript actually see the xd_receiver.htm file? Does it need a path (absolute or relative?) Is Apache serving static files from that directory?
What browsers have you observed the problem in? Try running in firefox with firebug installed to debug javasript problems. I'm not sure if the code you posted is actually what you're using, but it seems to be missing quotes on the "xd_receiver.htm" and also, no api key.
Regarding the xd_receiver.htm--> If the path to your callback url is callback, it should exist at callback/xd_receiver.htm. You have specified a relative path, so if your canvas page lives at /foo/page.htm, then the receiver page should exist at /foo/xd_receiver.htm. You could also specify at absolute path like '/xd_receiver.htm' and just keep your xd_receiver at the root.
Your page should look something like this:
http://gist.github.com/156633