<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>Xen Project</title>
	
	<link>http://www.xenproject.com</link>
	<description>Webdesign and development</description>
	<lastBuildDate>Sat, 09 Mar 2013 00:32:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/XenProject" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="xenproject" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Adding Disqus comments system to your e107 website</title>
		<link>http://www.xenproject.com/2011/05/adding-disqus-comments-system-to-your-e107-website/</link>
		<comments>http://www.xenproject.com/2011/05/adding-disqus-comments-system-to-your-e107-website/#comments</comments>
		<pubDate>Mon, 30 May 2011 15:01:46 +0000</pubDate>
		<dc:creator>Leon Lloyd</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.xenproject.com/?p=478</guid>
		<description><![CDATA[Disqus is a global comments system which makes building your community easier by allowing your users to comment on your posts in realtime and the ability to integrate with the most popular social networks. I&#8217;m going to show you how to implement the Disqus comment system on your e107 website. Before you do anything you [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.disqus.com">Disqus</a> is a global comments system which makes building your community easier by allowing your users to comment on your posts in realtime and the ability to integrate with the most popular social networks.</p>
<p>I&#8217;m going to show you how to implement the Disqus comment system on your e107 website. Before you do anything you will need to create an account on Disqus and make a note of your &#8216;forum name&#8217; which is created for you when you create your account. Log in to Disqus and have a look around the settings, these can be changed at any time.<span id="more-478"></span></p>
<p>Now you have created your account we can get it working on your e107 site. The implementation of Disqus is very easy and doesn&#8217;t require any modification of core files, all we are doing is creating a couple of new shortcodes and adding them to our theme &#8211; whichever theme you are using!</p>
<p>Let&#8217;s first create a new shortcode file for our comments box. Name the file disqus.sc and add it to your theme&#8217;s folder.</p>
<p><code>global $pref,$tp;</p>
<p>$test= explode('.',e_QUERY);</p>
<p>if (e_QUERY == ''|| $test[0]== 'default')<br />
{<br />
return;<br />
}<br />
else<br />
{</p>
<p>$news_item = getcachedvars('current_news_item');<br />
$mode = ($parm == "extend") ? "extend" : "item";</p>
<p>return "<br />
&lt;div id='disqus_thread'&gt;&lt;/div&gt;<br />
&lt;script type='text/javascript'&gt;<br />
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */<br />
    var disqus_shortname = 'example'; // required: replace example with your forum shortname</p>
<p>    // The following are highly recommended additional parameters. Remove the slashes in front to use.<br />
    // var disqus_identifier = '".SITEURL."news.php?extend.".$news_item['news_id']."';<br />
     var disqus_url = '".SITEURL."news.php?extend.".$news_item['news_id']."';</p>
<p>    /* * * DON'T EDIT BELOW THIS LINE * * */<br />
    (function() {<br />
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;<br />
        dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';<br />
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);<br />
    })();<br />
&lt;/script&gt;<br />
&lt;noscript&gt;Please enable JavaScript to view the &lt;a href='http://disqus.com/?ref_noscript'&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;<br />
&lt;a href='http://disqus.com' class='dsq-brlink'&gt;Comments powered by &lt;span class='logo-disqus'&gt;Disqus&lt;/span&gt;&lt;/a&gt;</p>
<p>	    ";<br />
	   }</code></p>
<p>Make sure to edit the above code with your forum shortname which was created for you when you created your account. There is no need to make any other modifications. The code above will display the comments under the extended news only.</p>
<p>Your probably going to want to display a link to your comments on your homepage, so lets make a new shortcode for that too. We&#8217;ll call this disqus_link.sc, add this to the theme folder too.</p>
<p><code>global $pref,$tp;</p>
<p>$news_item = getcachedvars('current_news_item');<br />
$mode = ($parm == "extend") ? "extend" : "item";</p>
<p>return "</p>
<p>&lt;a href='".SITEURL."news.php?extend.".$news_item['news_id']."#disqus_thread'&gt;Comments&lt;/a&gt;</p>
<p>";</code></p>
<p>That&#8217;s our shortcodes done, now we have to register them in our theme so they display the output. Open you theme&#8217;s <strong>theme.php</strong> file and add the following code anywhere before <strong>$layout = &#8220;_default&#8221;;</strong></p>
<p><code>$register_sc[]="DISQUS";<br />
$register_sc[]="DISQUS_LINK";</code></p>
<p>Now find the news style and add your new shortcode to it under the existing EXTENDED shortcode. Your news style should now look something like this:</p>
<p><code>$NEWSSTYLE = "<br />
					&lt;div&gt;<br />
						&lt;h2&gt;{NEWSTITLELINK=extend}&lt;/h2&gt;<br />
						&lt;ul&gt;<br />
							&lt;li&gt;Date: {NEWSDATE}&lt;/li&gt;<br />
							&lt;li&gt;Author: {NEWSAUTHOR}&lt;/li&gt;<br />
							&lt;li&gt;Category: {NEWSCATEGORY}&lt;/li&gt;<br />
                                                        &lt;li&gt;{DISQUS_LINK}&lt;/li&gt;<br />
						&lt;/ul&gt;<br />
							{NEWSBODY}<br />
							{EXTENDED}<br />
                                                        {DISQUS}<br />
					&lt;/div&gt;<br />
";</code></p>
<p>Clear your site&#8217;s cache and your comments system should now be up and running. Disqus has a number of widgets available which can display recent comments, most popular threads and top commenter menus which can be added to your site by simply adding the code supplied to a custom menu.</p>
<p>I hope you find this useful, I personally think the Disqus system is awesome, it has loads of features, my favourite has to be logging in using your Twitter or Facebook account and I haven&#8217;t had any of the usual e107 spammers yet, which is a bonus!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xenproject.com/2011/05/adding-disqus-comments-system-to-your-e107-website/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
