Tricked Out News

Welcome to TON. This site is dedicated to development of addons for the RavenNuke™ CMS
Follow Us:
Tricked Out Mods: Forums

 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tricked Out News with Disqus
 Goto page 1, 2  Next
 
Post new topic   Reply to topic   print    Tricked Out News Forum Index -> Tricked Out News
View previous topic :: View next topic  
Author Message
bestbuildpc
I might as well work here
I might as well work here


Joined: Nov 16, 2009
Posts: 61

Reputation: 20.5Reputation: 20.5

PostPosted: Sat Nov 13, 2010 9:33 am 
Post subject: Tricked Out News with Disqus
Reply with quote

Hi Bobby.

I tried to use Disqus for RavenNuke but I got errors. Can you point me where or what files I have to modify. It will be nice if you share your files to make the modification. I guess I have to create an API too. Please le me know. Lots of sites are running Disqus. It looks really powerfull and smooth. Very Happy
  
Back to top
View user's profile Send private message Visit poster's website
bobby
Site Admin
Site Admin


Joined: Jan 20, 2009
Posts: 600
Location: North Carolina
Reputation: 543Reputation: 543Reputation: 543
votes: 4

PostPosted: Sat Nov 13, 2010 10:21 am 
Post subject:
Reply with quote

I am in the finishing stages of releasing the modification. I still have a few more tweaks that need to be done. It will be in the forums soon.
_________________
Tricked Out News
  
Back to top
View user's profile Send private message
bestbuildpc
I might as well work here
I might as well work here


Joined: Nov 16, 2009
Posts: 61

Reputation: 20.5Reputation: 20.5

PostPosted: Sat Nov 13, 2010 10:55 am 
Post subject:
Reply with quote

Thanks, it will be nice. I gotta go right now. I think it will be a long day today. See u soon.
  
Back to top
View user's profile Send private message Visit poster's website
neralex
Regular
Regular


Joined: Nov 01, 2010
Posts: 15

Reputation: 19Reputation: 19

PostPosted: Fri Dec 17, 2010 10:55 am 
Post subject:
Reply with quote

hey! give it news to this cool addon? i would like to insert it in the ravennuke. where can i add the code from disqus... at the end of the article.php?
  
Back to top
View user's profile Send private message
bobby
Site Admin
Site Admin


Joined: Jan 20, 2009
Posts: 600
Location: North Carolina
Reputation: 543Reputation: 543Reputation: 543
votes: 4

PostPosted: Fri Dec 17, 2010 11:05 am 
Post subject:
Reply with quote

In the standard RavenNuke news module, look in articles.php and find:
Code:
if ((empty($mode) || $acomm == 0 || $articlecomm == 1) && $mode != 'nocomments') {

   include_once 'modules/News/comments.php';
}


That is what should be replaced with the Disqus code.
_________________
Tricked Out News
  
Back to top
View user's profile Send private message
neralex
Regular
Regular


Joined: Nov 01, 2010
Posts: 15

Reputation: 19Reputation: 19

PostPosted: Sun Dec 19, 2010 11:11 am 
Post subject:
Reply with quote

thanks. but i have a problem. the comments don't work in all articles. in 3 ids display the comment field but in all other articles i become this notice: "We were unable to load Disqus. If you are a moderator please see our documentation on identifier and urls." my identifier is $sid. i have try it with your disqus code but i beome the same.
  
Back to top
View user's profile Send private message
bobby
Site Admin
Site Admin


Joined: Jan 20, 2009
Posts: 600
Location: North Carolina
Reputation: 543Reputation: 543Reputation: 543
votes: 4

PostPosted: Sun Dec 19, 2010 11:39 am 
Post subject:
Reply with quote

Hmmm. That may be a Disqus issue. If it works on one, it should work on all. Send me a link and I will look at it and see is the sid is loading correctly within the page.
_________________
Tricked Out News
  
Back to top
View user's profile Send private message
spasticdonkey
Super Dev Donkey
Super Dev Donkey


Joined: May 08, 2009
Posts: 57

Reputation: 324Reputation: 324
votes: 1

PostPosted: Sun Dec 19, 2010 11:47 am 
Post subject:
Reply with quote

I did mine a little differently, this might work for you.. replace YOUR_SHORTNAME Wink
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
View user's profile Send private message
neralex
Regular
Regular


Joined: Nov 01, 2010
Posts: 15

Reputation: 19Reputation: 19

PostPosted: Sun Dec 19, 2010 12:46 pm 
Post subject:
Reply with quote

yeah it works! thanks, spasticdonkey!
  
Back to top
View user's profile Send private message
bobby
Site Admin
Site Admin


Joined: Jan 20, 2009
Posts: 600
Location: North Carolina
Reputation: 543Reputation: 543Reputation: 543
votes: 4

PostPosted: Sun Dec 19, 2010 1:08 pm 
Post subject:
Reply with quote

Awesome. Thanks Spastic....Smile
_________________
Tricked Out News
  
Back to top
View user's profile Send private message
spasticdonkey
Super Dev Donkey
Super Dev Donkey


Joined: May 08, 2009
Posts: 57

Reputation: 324Reputation: 324
votes: 1

PostPosted: Sun Dec 19, 2010 2:48 pm 
Post subject:
Reply with quote

hey no problem, looks like we were posting @ same time last round.. Smile
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 Smile

modules/News/index.php function theindex
FIND
Code:
      $story_link = '<a href="news.html?amp;file=article&amp;sid=' . $sid . '">';

AFTER ADD (for shortlinks)
Code:
      if (defined('TNSL_USE_SHORTLINKS')){

      $articleurl = $nukeurl.'/article'.$sid.'.html';
      }else{
      $articleurl = $nukeurl.'/modules.php?name=News&amp;file=article&amp;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 Wink
  
Back to top
View user's profile Send private message
neralex
Regular
Regular


Joined: Nov 01, 2010
Posts: 15

Reputation: 19Reputation: 19

PostPosted: Mon Dec 20, 2010 1:32 am 
Post subject:
Reply with quote

it does not want to count. (0 Comments)

spasticdonkey wrote:
notice you do not use language defines as those settings are configured @ disqus
yourshortnamehere.disqus.com/admin/settings/appearance/

what do you mean with it? the language defines from the nuke?
i don't have a lang selection on /admin/settings/appearance/ @ disqus.
  
Back to top
View user's profile Send private message
spasticdonkey
Super Dev Donkey
Super Dev Donkey


Joined: May 08, 2009
Posts: 57

Reputation: 324Reputation: 324
votes: 1

PostPosted: Mon Dec 20, 2010 9:13 am 
Post subject:
Reply with quote

Disqus replaces the "Comments" text with what you specify at yourshortname.disqus.com/admin/settings/appearance/
Code:
<a href="'.$articleurl.'#disqus_thread">Comments</a>

Image

As for the comment count, it will only count comments made at the target of the link. Try making a new comment and see if it updates. Any prior comments that did not specify the disqus_url or used a different disqus_identifier may not be counted. The fact that it is displaying "0 comment"s tells me the script is working, it's just not able to find any posts attached to that URL.

I would also view the html source of both the news index and article page, and make sure that the link from the news index and the disqus_url used on articles is the same... it should be Smile
  
Back to top
View user's profile Send private message
neralex
Regular
Regular


Joined: Nov 01, 2010
Posts: 15

Reputation: 19Reputation: 19

PostPosted: Mon Dec 20, 2010 6:48 pm 
Post subject:
Reply with quote

i have the same generated articleurl in both files but it does not want to count. i am testing local install with xampp and switch the disqus_developer to 1 in both files. is the localserver the problem?

greetz
  
Back to top
View user's profile Send private message
spasticdonkey
Super Dev Donkey
Super Dev Donkey


Joined: May 08, 2009
Posts: 57

Reputation: 324Reputation: 324
votes: 1

PostPosted: Mon Dec 20, 2010 8:45 pm 
Post subject:
Reply with quote

that's very possible, I have not tried it on a local install.

there is the non-compliant version, I don't really recommend it but it supposedly counts more reliably
Code:
<a href="'.$articleurl.'#disqus_thread" data-disqus-identifier="'.$module_name.'-'.$sid.'">Comments</a>
  
Back to top
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic   print    Tricked Out News Forum Index -> Tricked Out News All times are GMT - 5 Hours
 Goto page 1, 2  Next
 Page 1 of 2

 

Jump to:   
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001-2008 phpBB Group
Forums ©