Topic: How do I intergrate Cutenews with Disqus?

is it possible? if so, how?

Re: How do I intergrate Cutenews with Disqus?

is it possible? if so, how?

Yes It is.
I've done it here:
http://nhlkollen.se/

I don't have time to explain right now, but I'll can write "how to" to you tomorrow if you want. (If nobody else answers first.)

Re: How do I intergrate Cutenews with Disqus?

thank you so much. I would greatly appreciate it.

Re: How do I intergrate Cutenews with Disqus?

Ok, this is how I've done it. It may not be the best way, or the most correct way.
You may want to backup some files if something goes wrong. I think I wrote everything that is needed to do this, if not I'll help you until it works!

if you come across any problems, say what's the problem is, and link your website and I'll help you. http://cutephp.com/forum/style_emoticons/default/smile.gif

1. Go to http://disqus.com/ and sign up.
2. Login on your account on disqus.
3. Under the tab "Moderate" click "Install".
4. Now you will see alot of options like WordPress, Blogger, Tumblr etc. But if you look down you will see one that says "Universal Code". Press that.
On this page you will see some like "Your forum shortname is *******" That shortname is very important.
6. Copy the code under "Embed code". It should look like this:

<div id="disqus_thread"></div>
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'example'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (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 [url=http://disqus.com/?ref_noscript]comments powered by Disqus.[/url]</noscript>
[url=http://disqus.com]blog comments powered by <span class="logo-disqus">Disqus</span>[/url]

7. Now the fun part. Login on your Cutenews and go to Options > Edit templates > Full Story.
Paste your disqus code somewhere here. (You should paste it on the buttom so the comments are after the text...) 

Now before you save you must change "example" to your own disqusshort name. You will see the short name on this site:
http://docs.disqus.com/developers/universal/

var disqus_shortname = 'example'; // required: replace example with your forum shortname

8. Erase everything under "Add comment form","Comment" and "Comments Pagination". (to remove cutenews comments.)

That should work now. But that won't count the comments. If you want to do that there some more work:

1. Login on your disqus account and go to Moderate > Install > Universal Code > Scroll down until you see "Commet count".
Copy this code:

<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'example'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function () {
        var s = document.createElement('script'); s.async = true;
        s.type = 'text/javascript';
        s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
        (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
    }());
</script>

2. Login on your cutenews agian.
3. Go to Options > Edit templates > Active News. Here you will find cutenews own link to the comments. Something like this [com-link]Comment {comments-num}[/com-link]

Remove that and paste this:

<div style="float: right;">[link]<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'example'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function () {
        var s = document.createElement('script'); s.async = true;
        s.type = 'text/javascript';
        s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
        (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
    }());
</script>[/link]</div>

4. Remember to change "example" to your shortname agian. If you save now, you will see that there is a new link to the comments and that's the Disqus link. But, still It can't count the comments. Now it's may get's a little more tricky.

5.Now you need to go to login on your FTP program and navigate to cutenews folder > inc > and open "shows.inc".
Here you should find a line that looks like this:

$output = str_replace("[link]","<a href="$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query">", $output);

Replace that line with this:

$output = str_replace("[link]","<a href="$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&#disqus_thread$user_query">", $output);

That's gonna add "#disqus_thread" to your url when you're in full story.

That should be it!
If you want to change the "Comment this" text or what it says. Login on disqus.com, go to settins > appearance and scroll down to. "Comment Count Link"

Re: How do I intergrate Cutenews with Disqus?

Hi NHLKOLLEN. I do what u write but have several problems. Comments work almost perfect but i can't put it into cutephp comments look at my site here. I have special place frame for comments.

When i do what You say about comments count(edit that file on ftp) i've got some php error.  Parse error: syntax error, unexpected T_VARIABLE in /home/bzrock/public_html/news/inc/shows.inc.php on line 693 can u help me with that?

Re: How do I intergrate Cutenews with Disqus?

Hi NHLKOLLEN. I do what u write but have several problems. Comments work almost perfect but i can't put it into cutephp comments look at my site here. I have special place frame for comments.

When i do what You say about comments count(edit that file on ftp) i've got some php error.  Parse error: syntax error, unexpected T_VARIABLE in /home/bzrock/public_html/news/inc/shows.inc.php on line 693 can u help me with that?

First of the comments count. There shouldn't actually be a problem, since you just adding #disqus_thread to your fullstory url. How do u enter into full story? How does your template look on "active story"?

About the other thing. The problem is that cutenews comment is in edit templates > comment and edit templates > add comment. But I've tried to put the disqus comments there instead of edit templates > full story, and it didn't work good.

So the thing you could do is this:

You can try to put this code instead in edit templates > full story. (remember to change example to your disqus shortname.)

</br>
http://i.imgur.com/bsKms.gif?1?2940<div id="disqus_thread"></div>
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'example'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (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 comments powered by Disqus.</noscript>

You basiclly just adds a picture before disqus comments to make it look like before. You may want to make your own picture so make it look correct.

Re: How do I intergrate Cutenews with Disqus?

Thanks a million, NHLKOLLEN. It was a lot less complicated than I thought it would be.

Re: How do I intergrate Cutenews with Disqus?

How do i enter into full story? Under short story i have clickable text read more(default by cutephp).I think that disqus comment work perfect. Now i can't do that thing with comments counter. When i try to put that thing:

<quote> $output = str_replace("[link]","[url=$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&#disqus_thread$user_query]", $output); </quote>

i have that PHP error(when i want to open my page in firefox or explorer have white page with that error):

Pharse error: syntax error, unexpected T_VARIABLE in /home/bzrock/public_html/news/inc/shows.inc.php on line 693 can u help me with that?

Here is my shows.inc.php file <a href="https://rapidshare.com/files/3272212661/shows.inc.php" target="_blank">click[/url]/

hope You can help me with that

and one more thing maybe You know how to add something like this to my page:
When i want to post link to my page(or to news on my page) facebook always write the same link discription with the same thumb image. When i want to put something on facebook i want discription from last news(or from news to which url i post.

Re: How do I intergrate Cutenews with Disqus?

$output = str_replace("[link]","<a href="$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query">", $output);

Should be one, single line, this forum just breaks it...

Re: How do I intergrate Cutenews with Disqus?

How do i enter into full story? Under short story i have clickable text read more(default by cutephp).I think that disqus comment work perfect. Now i can't do that thing with comments counter. When i try to put that thing:

<quote> $output = str_replace("[link]","[url=$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&#disqus_thread$user_query]", $output); </quote>

i have that PHP error(when i want to open my page in firefox or explorer have white page with that error):

Pharse error: syntax error, unexpected T_VARIABLE in /home/bzrock/public_html/news/inc/shows.inc.php on line 693 can u help me with that?

Here is my shows.inc.php file <a href="https://rapidshare.com/files/3272212661/shows.inc.php" target="_blank">click[/url]/

hope You can help me with that

and one more thing maybe You know how to add something like this to my page:
When i want to post link to my page(or to news on my page) facebook always write the same link discription with the same thumb image. When i want to put something on facebook i want discription from last news(or from news to which url i post.

If you go to my site, www.nhlkollen.se, you can see the text under my posts that says "Lägg en kommentar" which means "Comment". That line "Lägg en kommentar" is made by disqus.

If you press on "Lägg en kommentar" you will see in the url, for example:
http://nhlkollen.se/index.php?subaction=sh...amp;ucat=3&#disqus_thread

that #disqus_thread is in the end of the url. To make disqus count the comments you gonna need to add #disqus_thread to your url when in full story. This line:
$output = str_replace("[link]","<a href="$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&#disqus_thread$user_query">", $output);

Adds that to the url if you use [link]Comment[/link].
Can u paste your edit templatess > active news? That would help alot! http://cutephp.com/forum/style_emoticons/default/smile.gif

Re: How do I intergrate Cutenews with Disqus?

@Ifa I know that but still have the same error...

12

Re: How do I intergrate Cutenews with Disqus?

$output = str_replace("[link]","<a href=\"$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query\">", $output);

http://cutephp.com/forum/style_emoticons/default/smile.gif

Re: How do I intergrate Cutenews with Disqus?

<!--oddzielnik-->
          <tr>
          <td height="45" background="images/rightbar_01.png">
          </td>
          </tr>
          <tr>
          <td  background="images/rightbar_02.png" valign="top">
     <table width="660" align="center">
          <tr>
          <td width="660" class="inside">

<font size="1">Posted on {date} by {author}</font>
<h2>• {title} •</h2>

{short-story}

<p align="right">[com-link]{comments-num} Comments[/com-link] [full-link]Read more[/full-link]</p>
         </td>
         </tr>
         </table>
         </td>
         </tr>
         <tr>
         <td height="30" background="images/rightbar_02.png"> </td>
         </tr>
         <tr>
         <td height="39" background="images/rightbar_03.png"> </td>
         </tr>
           <!--oddzielnik-->

Re: How do I intergrate Cutenews with Disqus?

<!--oddzielnik-->
          <tr>
          <td height="45" background="images/rightbar_01.png">
          </td>
          </tr>
          <tr>
          <td  background="images/rightbar_02.png" valign="top">
     <table width="660" align="center">
          <tr>
          <td width="660" class="inside">

<font size="1">Posted on {date} by {author}</font>
<h2>• {title} •</h2>

{short-story}

<p align="right">[com-link]{comments-num} Comments[/com-link] [full-link]Read more[/full-link]</p>
         </td>
         </tr>
         </table>
         </td>
         </tr>
         <tr>
         <td height="30" background="images/rightbar_02.png"> </td>
         </tr>
         <tr>
         <td height="39" background="images/rightbar_03.png"> </td>
         </tr>
           <!--oddzielnik-->

Ok, as you can see u using [com-link] to link to your full story. Change [com-link] to [link] Comment here [/link] instead and see how that works. http://cutephp.com/forum/style_emoticons/default/smile.gif

Re: How do I intergrate Cutenews with Disqus?

...not work again  NHLKOLLEN can u help me with that if i create for You admin account to english version of my site? I'm too dumb... Thanks if you agree to help me http://cutephp.com/forum/style_emoticons/default/smile.gif

16 (edited by 2012-04-07 10:04:58)

Re: How do I intergrate Cutenews with Disqus?

...not work again  NHLKOLLEN can u help me with that if i create for You admin account to english version of my site? I'm too dumb... Thanks if you agree to help me http://cutephp.com/forum/style_emoticons/default/smile.gif

Sure I can try to help, send a message here on the forum with the account information! http://cutephp.com/forum/style_emoticons/default/smile.gif

17 (edited by 2012-04-07 10:26:50)

Re: How do I intergrate Cutenews with Disqus?

check pm

18 (edited by 2013-02-10 01:30:13)

Re: How do I intergrate Cutenews with Disqus?

Cant find the line

$output = str_replace("[link]","<a href="$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query">", $output);

in shows.php

In the newest version, is the line somwhere else?

19 (edited by 2013-02-10 07:03:51)

Re: How do I intergrate Cutenews with Disqus?

I can't find this code in the 1.5 version. How to integrate cutenews with disqus original how to thread. This post has been edited by joifan2k: Aug 20 2012, 08:24 ...

Re: How do I intergrate Cutenews with Disqus?

I can't find this code in the 1.5 version. How to integrate cutenews with disqus original how to thread. This post has been edited by joifan2k: Aug 20 2012, 08:24 ...

Look in core.php for

$output  = str_replace(array("[link]", "[/link]"), array('[url=]', "[/url]"), $output);


But I cannot guarantee that the hack will work in this new version.

Re: How do I intergrate Cutenews with Disqus?

it works, and i did not have to change that line. I Actually found #disqus_tread already in the core.php
So to get it to work, skip that step http://cutephp.com/forum/style_emoticons/default/smile.gif

22 (edited by 2013-07-15 04:34:52)

Re: How do I intergrate Cutenews with Disqus?

Comments work almost perfect but i can't put it into cutephp comments look at my site here. I have special place frame for comments.
When i do what You say about comments count(edit that file on ftp) i've got some php error. Parse error: syntax error, unexpected T_VARIABLE in /home/bzrock/public_html/news/inc/shows.inc.php on line 693 can u help me with that?

23 (edited by 2014-09-24 08:09:45)

Re: How do I intergrate Cutenews with Disqus?

*****edited: fixed****

24 (edited by 2014-09-24 08:23:08)

Re: How do I intergrate Cutenews with Disqus?

Nevermind, I fixed it. Now there's one more issue: i have multiple php pages that use the cutenews script BUT the disqus comment counter seems to work only on one of them. In

mysite.com/index.php

i see the posts with the disqus comment counter. But in

mysite.com/index-2.php

the counter does not appear. While in


mysite.com/index-3.php

the counter appears in some posts but not in everyone of them. The code in "index"  "index-2" and  "index-3"  is the same, i don't really understand this issue. Any ideas?

I mean, THE SAME post HAS its comment counter if shown through "index.php", and it HAS NOT if you see it through "index-2.php".
How's that possible?

Re: How do I intergrate Cutenews with Disqus?

Hi! I've a problem with last part. I can't find

$output = str_replace("[link]","[url=$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query]", $output);


Or something like this. I haven't any $output variable.

This is my shows.inc.php

<?php

if (!defined('INIT_INSTANCE')) die('Access restricted');

$CNpass             = isset($_COOKIE['CNpass']) && $_COOKIE['CNpass'] ? $_COOKIE['CNpass'] : false;
$captcha_enabled    = $CNpass ? false : true;

// ---------------------------------------------------------------------------------------------------------------------
do
{
    // plugin tells us: he is fork, stop
    if ( hook('fork_shows_inc', false) ) break;

    // Used if we want to display some error to the user and halt the rest of the script
    $user_query      = cute_query_string($QUERY_STRING, array( "comm_start_from", "start_from", "archive", "subaction", "id", "ucat"));
    $user_post_query = cute_query_string($QUERY_STRING, array( "comm_start_from", "start_from", "archive", "subaction", "id", "ucat"), "post");

    // Define Categories
    $cat = array();
    $cat_lines = file(SERVDIR."/cdata/category.db.php");
    foreach ($cat_lines as $single_line)
    {
        $cat_arr                        = explode("|", $single_line);
        $cat[ $cat_arr[CAT_ID] ]        = $cat_arr[CAT_NAME];
        $cat_icon[ $cat_arr[CAT_ID] ]   = $cat_arr[CAT_ICON];
    }

    // Define Users
    $all_users = file(SERVDIR."/cdata/users.db.php");
    unset ($all_users[UDB_ID]);

    foreach ($all_users as $user)
    {
        $user_arr = user_decode($user);

        // nick exists?
        if ($user_arr[UDB_NICK])
        {
            $my_names[$user_arr[UDB_NAME]]     = ($user_arr[UDB_CBYEMAIL] != 1 and $user_arr[UDB_EMAIL])? '<a href="mailto:'.hesc($user_arr[UDB_EMAIL]).'">'.hesc($user_arr[UDB_NICK]).'[/url]' : hesc($user_arr[UDB_NICK]);
            $name_to_nick[$user_arr[UDB_NAME]] = $user_arr[UDB_NICK];
        }
        else
        {
            $my_names[$user_arr[UDB_NAME]]     = ($user_arr[UDB_CBYEMAIL] != 1 and $user_arr[UDB_EMAIL])? '[url=mailto:]'.hesc($user_arr[UDB_NAME]).'[/url]' : hesc($user_arr[UDB_NAME]);
            $name_to_nick[$user_arr[UDB_NAME]] = $user_arr[UDB_NAME];
        }

        $my_mails[ $user_arr[UDB_NAME] ]   = ($user_arr[UDB_CBYEMAIL] == 1)? "" : $user_arr[UDB_EMAIL];
        $my_passwords[$user_arr[UDB_NAME]] = $user_arr[UDB_PASS];
        $my_users[] = $user_arr[UDB_NAME];

    }

    ResynchronizePostponed();
    if ($config_auto_archive == "yes") ResynchronizeAutoArchive();
    hook('resync_routines');

    // Add Comment -----------------------------------------------------------------------------------------------------
    if ($allow_add_comment)
    {
        $break = include (SERVDIR.'/core/com/allow_add_comment.php');
        if ($break === FALSE) { $CN_HALT = TRUE; break; }
    }

    // Show Full Story -------------------------------------------------------------------------------------------------
    if ($allow_full_story)
    {
        $break = include (SERVDIR.'/core/com/allow_full_story.php');
        if ($break === FALSE) { $CN_HALT = TRUE; break; }
    }

    // Show Comments ---------------------------------------------------------------------------------------------------
    if ($allow_comments)
    {
        $break = include (SERVDIR.'/core/com/allow_comments.php');
        if ($break === FALSE) { $CN_HALT = TRUE; break; }
    }

    // Active News -----------------------------------------------------------------------------------------------------
    if ($allow_active_news)
    {
        $break = include (SERVDIR.'/core/com/allow_active_news.php');
        if ($break === FALSE) { $CN_HALT = TRUE; break; }
    }
}
while (FALSE);

// ---------------------------------------------------------------------------------------------------------------------
if ((!isset($count_cute_news_includes) or !$count_cute_news_includes) and $template != 'rss')
{
    /// Removing the "Powered By..." line is NOT allowed by the CuteNews License, only registered users are alowed to do so.
    if (!file_exists(SERVDIR."/cdata/reg.php"))
    {
         echo base64_decode('PGRpdiBzdHlsZT0ibWFyZ2luLXRvcDoxNXB4O3dpZHRoOjEwMCU7dGV4dC1hbGlnbjpjZW50ZXI7
Zm9udDo5cHggVmVyZGFuYTsiPlBvd2VyZWQgYnkgPGEgaHJlZj0iaHR0cDovL2N1dGVwaHAuY29tLyIgd
Gl0bGU9IkN1dGVOZXdzIC0gUEhQIE5ld3MgTWFuYWdlbWVudCBTeXN0ZW0iPkN1dGVOZXdzPC9hPjwvZG
l2Pg==');
    }
    else
    {
        include(SERVDIR."/cdata/reg.php");
        if ( !preg_match('/\\A(\\w{6})-\\w{6}-\\w{6}\\z/', $reg_site_key, $mmbrid))
        {
            echo base64_decode('PGRpdiBzdHlsZT0ibWFyZ2luLXRvcDoxNXB4O3dpZHRoOjEwMCU7dGV4dC1hbGlnbjpjZW50ZXI7
Zm9udDo5cHggVmVyZGFuYTsiPkNvbnRlbnQgTWFuYWdlbWVudCBQb3dlcmVkIGJ5IDxhIGhyZWY9Imh0d
HA6Ly9jdXRlcGhwLmNvbS8iIHRpdGxlPSJDdXRlTmV3cyAtIFBIUCBOZXdzIE1hbmFnZW1lbnQgU3lzdG
VtIj5DdXRlTmV3czwvYT48L2Rpdj4=');
        }
    }
}

$count_cute_news_includes++;

Posts: 1 to 25 of 29

Pages 1 2 Next

You must login or register to post a reply

CutePHP Forums → Problem Solving / Help & Support → How do I intergrate Cutenews with Disqus?



The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.