| Author |
Message |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic
|
Posted:
Tue Feb 08, 2011 1:56 pm |
 
|
Inspired by the work done by Bobby over at www.trickedoutnews.com I thought I would integrate Disqus into my News (Tricked Out News 2.5E) module before he releases Tricked Out News 2.6 with the Disqus modifications already done.
Simple enough after registering for a free account at www.disqus.com
In modules/News/article.php
FIND
comment out that line and all the code down to and including the line before
Code:include_once 'footer.php';
|
Above this commented out section of code, ADD the following code after replacing your DISQUS_SHORT_NAME with your disqus shortname provided in your Disqus account.
Code:// Disqus
$articleurl = $nukeurl.'/article'.$sid.'.html';
OpenTable();
echo '<div></div>
<script>
//<CDATA>
</script>
<noscript>Please enable JavaScript to view the <a>comments powered by Disqus.</a></noscript>
<a>Comments powered by <span class="logo-disqus">Disqus</span></a><br>';
CloseTable();
// Disqus
|
The above section of code was supplied by spasticdonkey from this thread; http://www.trickedoutnews.com/ftopict-126.html I have just added CDATA tags so the comments only display once all the background work is finished.
I have applied and been accepted for a Developers API key, so I may expand on this with a view to creating some sort of 'global' commenting system, provided the API allows remote access. In essence, possibly a Comment module to allow you to remotely manage your Disqus account. |
_________________ TPD |
|
|
 |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic
|
Posted:
Tue Feb 08, 2011 6:20 pm |
 
|
Just to gauge how easy Disqus is to integrate with something that actually never had user comments, I have just added Disqus to my Content Plus module. Only took about 10 minutes so I'm quite impressed with it so far  |
_________________ TPD |
|
|
 |
sortilege2021
Newbie


Joined: Feb 09, 2011
Posts: 2
|
Posted:
Wed Feb 09, 2011 6:46 pm |
 
|
thanks for share it, how to add disqus in the module nuketube? |
| |
|
|
 |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic
|
Posted:
Wed Feb 09, 2011 7:35 pm |
 
|
All the information you need is posted or linked to above ^^
I'm actually looking at other ways to implement it, one a PHP Class and the other a jQuery plug-in. The code I have used here is pretty much the same as the code available on the Disqus website. It is just a matter of having a unique indentifier so the comments get linked to a specific piece of information.
Unfortunately time doesn't allow me to write a full tutorial, though a couple of clients have expressed an interest in having some modules modified to use Disqus that did not have any commenting facility originally. |
_________________ TPD |
|
|
 |
sortilege2021
Newbie


Joined: Feb 09, 2011
Posts: 2
|
Posted:
Wed Feb 09, 2011 7:44 pm |
 
|
|
|
 |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic
|
Posted:
Wed Feb 09, 2011 7:51 pm |
 
|
If you need help and are not in a rush, feel free to PM me and I'll try and do what I can. |
_________________ TPD |
|
|
 |
montego
Site Admin


Joined: Jan 06, 2006
Posts: 311
|
Posted:
Tue Feb 15, 2011 11:18 am |
 
|
|
|
 |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic
|
Posted:
Tue Feb 15, 2011 11:56 am |
 
|
Regarding site wide commenting system;
I am now using Disqus here, it is very simple to integrate and since Tricked Out News already comes with the requisite disqus.php file which contains a few simple functions to do the grunt work, I'm not sure about the benefits of developing a seperate commenting system.
I spent 2 days playing with a comment administration system for Disqus to allow you to remotely access Disqus using their API to manage comments; edit/delete/flag as spam etc etc and using the API itself to display the 'comment' code for posting comments (instead of the method used here).
However, I ran into a deal breaker. The standard 'free' Disqus account only allows 1000 accesses to their API per hour and I just don't think that limitation justifies further development as most people will be using the 'free' Disqus account and can do everything from their account at Disqus any way.
The current implementation here of Disqus requires very few changes to 'core' code;
include the disqus.php file
modify page links or link building techniques that you need comments for by altering the link to add #disqus_thread to the link - easy as that!
Although Disqus seems to handle links to the same page very well i.e. Shortlinked and none ShortLinked url's I would recommend using something similar to the code below to as good practise.
Code:if (defined('TNSL_USE_SHORTLINKS')){
$pageurl = $nukeurl."/article$sid.html";
} else {
$pageurl = $nukeurl.'/modules.php?name=News&file=article&sid='.$sid.'';
}
|
|
_________________ TPD |
|
|
 |
montego
Site Admin


Joined: Jan 06, 2006
Posts: 311
|
Posted:
Tue Feb 15, 2011 1:12 pm |
 
|
|
|
 |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic
|
Posted:
Tue Feb 15, 2011 1:40 pm |
 
|
I could not agree more!
A Link Factory type API is really needed, along with a user management/authentication/permissions API and a few others I can think of BUT here is the kicker; is it actually worth it?
I am really, really struggling with the whole 'piecemeal' approach to RN now because every time, it requires third party modules to be re-written or themes to be re-written and so on...
Personally, I am at the stage where I would just like to use a framework and get it over with, instead of taking incremental steps to reach what will be no doubt the same end stage. |
_________________ TPD |
|
|
 |
spasticdonkey
Newbie


Joined: May 12, 2009
Posts: 74
Location: TX
|
Posted:
Tue Feb 15, 2011 4:17 pm |
 
|
is there a link factory class that looks particularly attractive? |
| |
|
|
 |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic
|
Posted:
Tue Feb 15, 2011 6:09 pm |
 
|
|
|
 |
Guardian
Site Admin


Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic
|
Posted:
Tue Feb 15, 2011 6:46 pm |
 
|
I actually broke it down a little more than the above article because OOP still confuses me at times.
I ended up using different files to perform different tasks.
Taking the Shop here as an example, for my content pages;
In htaccess, to redirect to the correct file I use something like
Code:RewriteRule view-content/(.*)-(.*)\.html$ content.php?id=$1&title=$2
|
This redirects the request to the 'handler' file which is content.php
In content.php I perform some routine checks and sanitisation on POST id
Then get the data;
Code:$template->set($content->getPageById($id));
|
Then display the data.
Linking structure is based on the following type of code ($slug being whatever I have set for the page when I wrote it as it's stored in the DB but defaults to the page 'title');
Code:$display = $config->settings['site-url'] . '/view-content/' . intval($id) . '-' . sanitise($slug) . '.html';
|
|
_________________ TPD |
|
|
 |
montego
Site Admin


Joined: Jan 06, 2006
Posts: 311
|
Posted:
Fri Feb 18, 2011 12:29 pm |
 
|
@Spastic - the way I am forced to "work" is formulate the concept in my mind of what my "requirements" are, but then I need to put them on the "shelf" to dust off at a time in the future when I have the time to work on it. At that point, I would do the needful research. So, I haven't looked for one, but I've used several tools (Wordpress, b2evolution, etc) that do this well, so I have seen how it could work.
@Guardian - Regarding "piecemeal"... wish I could disagree with you. Without focused resources to dedicate their time, piecemeal is the best we seem to be able to get. Just the nature of the beast. I'm just as guilty all these years. |
_________________ Where Do YOU Stand?
HTML Newsletter :: ShortLinks :: DynamicTitles :: Approved Membership Lite :: And more... |
|
|
 |
|
|