| View previous topic :: View next topic |
| Author |
Message |
bestbuildpc I might as well work here


Joined: Nov 16, 2009 Posts: 61
  
|
|
| Back to top |
|
 |
bobby Site Admin


Joined: Jan 20, 2009 Posts: 600 Location: North Carolina
    votes: 4
|
|
| Back to top |
|
 |
bestbuildpc I might as well work here


Joined: Nov 16, 2009 Posts: 61
  
|
|
| Back to top |
|
 |
neralex Regular


Joined: Nov 01, 2010 Posts: 15
  
|
|
| Back to top |
|
 |
bobby Site Admin


Joined: Jan 20, 2009 Posts: 600 Location: North Carolina
    votes: 4
|
|
| Back to top |
|
 |
neralex Regular


Joined: Nov 01, 2010 Posts: 15
  
|
|
| Back to top |
|
 |
bobby Site Admin


Joined: Jan 20, 2009 Posts: 600 Location: North Carolina
    votes: 4
|
|
| Back to top |
|
 |
spasticdonkey Super Dev Donkey


Joined: May 08, 2009 Posts: 57
   votes: 1
|
Posted: Sun Dec 19, 2010 11:47 am Post subject: |
|
|
I did mine a little differently, this might work for you.. replace YOUR_SHORTNAME
modules/News/article.php
add $nukeurl to your global statement
Code:global $multilingual, $currentlang, $admin_file, $user, $nukeurl;
|
I'm using shortlinks so notice how I constructed the url, change if you are not using. I disabled built-in comments and added at the bottom of page..
FIND
Code:if (is_admin($admin)) {
|
BEFORE ADD
Code: // Disqus
$articleurl = $nukeurl.'/article'.$sid.'.html';
OpenTable();
echo '<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = \'YOUR_SHORTNAME\';
var disqus_identifier = \''.$module_name.'-'.$sid.'\';
var disqus_url = \''.$articleurl.'\';
(function() {
var dsq = document.createElement(\'script\'); dsq.type = \'text/javascript\'; dsq.async = true;
dsq.src = \'http://\' + disqus_shortname + \'.disqus.com/embed.js\';
(document.getElementsByTagName(\'head\')[0] || document.getElementsByTagName(\'body\')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a><br />';
CloseTable();
// Disqus
|
|
|
| Back to top |
|
 |
neralex Regular


Joined: Nov 01, 2010 Posts: 15
  
|
|
| Back to top |
|
 |
bobby Site Admin


Joined: Jan 20, 2009 Posts: 600 Location: North Carolina
    votes: 4
|
|
| Back to top |
|
 |
spasticdonkey Super Dev Donkey


Joined: May 08, 2009 Posts: 57
   votes: 1
|
Posted: Sun Dec 19, 2010 2:48 pm Post subject: |
|
|
hey no problem, looks like we were posting @ same time last round..
found it was important to define both the disqus_identifier and disqus_url so that the comment counter code works correctly (at least the compliant version)
disqus is smart enough to merge threads at different addresses using the same disqus_identifier (i.e. if comments are entered at a shortlink and non shortlink version of a page, your site can be accessed with and without WWW, etc), but the comment counts will only reflect comments made at the target of the link, not the "merged" total. Kinda confusing, but hope that made sense.
lol, and before anyone asks here's the code changes for the standard news index to add disqus comment counts.
notice you do not use language defines as those settings are configured @ disqus
yourshortnamehere.disqus.com/admin/settings/appearance/
also remember to replace YOUR_SHORTNAME
modules/News/index.php function theindex
FIND
Code: $story_link = '<a href="news.html?amp;file=article&sid=' . $sid . '">';
|
AFTER ADD (for shortlinks)
Code: if (defined('TNSL_USE_SHORTLINKS')){
$articleurl = $nukeurl.'/article'.$sid.'.html';
}else{
$articleurl = $nukeurl.'/modules.php?name=News&file=article&sid='.$sid;
}
|
FIND
Code: if ($articlecomm == 1 AND $acomm == 0) {
if ($c_count == 0) {
$morelink .= $story_link . _COMMENTSQ . '</a>';
} elseif ($c_count == 1) {
$morelink .= $story_link . $c_count . ' ' . _COMMENT . '</a>';
} elseif ($c_count > 1) {
$morelink .= $story_link . $c_count . ' ' . _COMMENTS . '</a>';
}
}
|
REPLACE WITH
Code: $morelink .= '<a href="'.$articleurl.'#disqus_thread">Comments</a>';
|
FIND
Code: include_once 'footer.php';
|
BEFORE ADD
Code: echo '<script type="text/javascript">'."\n";
echo ' var disqus_shortname = \'YOUR_SHORTNAME\';'."\n";
echo ' (function () {'."\n";
echo ' var s = document.createElement(\'script\'); s.async = true;'."\n";
echo ' s.type = \'text/javascript\';'."\n";
echo ' s.src = \'http://disqus.com/forums/\' + disqus_shortname + \'/count.js\';'."\n";
echo ' (document.getElementsByTagName(\'HEAD\')[0] || document.getElementsByTagName(\'BODY\')[0]).appendChild(s);'."\n";
echo ' }());'."\n";
echo '</script>'."\n";
|
also note i did not test this as I'm using TON, but it should work  |
|
| Back to top |
|
 |
neralex Regular


Joined: Nov 01, 2010 Posts: 15
  
|
|
| Back to top |
|
 |
spasticdonkey Super Dev Donkey


Joined: May 08, 2009 Posts: 57
   votes: 1
|
|
| Back to top |
|
 |
neralex Regular


Joined: Nov 01, 2010 Posts: 15
  
|
|
| Back to top |
|
 |
spasticdonkey Super Dev Donkey


Joined: May 08, 2009 Posts: 57
   votes: 1
|
|
| Back to top |
|
 |
|
|