3 users online. Create an account or sign in to join them.Users
Facebook Comments
Implement with HTML5 or XFBML
Description
A simple utility for Facebook Comments.
See more information:
http://developers.facebook.com/docs/reference/plugins/comments/
XSLT
View Raw
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fb="http://ogp.me/ns/fb#"
exclude-result-prefixes="fb"
version="1.0">
<!--
Name: Facebook Comment Utility
Version: 1.0
Author: James Sidhu <james.thomas.sidhu@gmail.com>
Credits to Brian Zerangue <brian.zerangue@gmail.com> for the Facebook Like Utility which this utility is based on.
//How to use
<xsl:call-template name="fb-comments">
<xsl:with-param name="url" select="'http://site.com'"/>
</xsl:call-template>
//Required
<xsl:param name="url"/>
//Optional
<xsl:param name="num_posts" select="2"/>
<xsl:param name="width" select="500"/>
<xsl:param name="color_scheme" select="'light'"/> Options: light/dark
<xsl:param name="type" select="'html5'"/> Options: html5/xfbml
-->
<xsl:template name="fb-comments">
<xsl:param name="url"/><!-- Required -->
<xsl:param name="num_posts" select="2"/>
<xsl:param name="width" select="500"/>
<xsl:param name="color_scheme" select="'light'"/>
<xsl:param name="implementation" select="'html5'"/>
<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>
<xsl:if test="$implementation='html5'">
<div class="fb-comments" data-href="{$url}" data-num-posts="{$num_posts}" width="{$width}">
<xsl:attribute name="colorscheme">
<xsl:value-of select="$color_scheme"/>
</xsl:attribute>
</div>
</xsl:if>
<xsl:if test="$implementation='xfbml'">
<fb:comments
href="{$url}"
num_posts="{$num_posts}"
width="{$width}"
>
<xsl:attribute name="colorscheme">
<xsl:value-of select="$color_scheme"/>
</xsl:attribute>
</fb:comments>
</xsl:if>
</xsl:template>
</xsl:stylesheet>