Latest_Comments 1.1 for 2.5.x

Download plugins, language packs and stuff.

Postby master7 » Tue Apr 01, 2008 12:35 pm

Saszoo wrote:Yeah, we've noticed it and discussed it here: [ http://english.cutenews.ru/forum/viewto ... mments+rss ],
The whitespace was causing it, strange thing :P


Sorry, I didn't found this post ;)

On other sietes I read, that the "whitespace" causes XML error every time when you include php file into site.
User avatar
master7
 
Posts: 27
Joined: Tue Apr 11, 2006 1:34 pm

=] cnru rox

Postby ivanh » Thu Apr 03, 2008 8:40 am

i have two problems

if i use
Code: Select all
<?php include($cutepath . '/data/latest_comments.txt'); ?>
in say index.php

would this show all the latest comments?

i was wondering how i can display the lastest comments of a particular category aswell as all

maybe a function like $latest_comments[id] or something like that im not entirely sure


another thing
about a yr ago there was a post about how you can sort your news according to latest comments
i was wondering what the code was again
something like
$sort =array('latest_comm', 'ASC');
ivanh
 
Posts: 75
Joined: Thu Aug 16, 2007 2:41 pm

Postby FI-DD » Thu Apr 03, 2008 9:58 am

User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby ivanh » Thu Apr 03, 2008 1:17 pm

thanks for the link fi-dd!

could you help me with the first question aswell?
sorry if you explained it above - i didnt understand it ;(
ivanh
 
Posts: 75
Joined: Thu Aug 16, 2007 2:41 pm

Postby flyboy17 » Sun Jun 08, 2008 5:44 pm

great plug-in, but one request :roll: :)

I would like to show only unique newsitems (for example; when there are 7 replies on just 1 newsitem; the output will be those 7, same, newsitems)
So, is it possible? I tried to change the sql query but i thing i did something wrong (no 'recently commented news' at all)
(I changed sql query with --> distinct(post_id)

Thanks for you help! :)
flyboy17
 
Posts: 63
Joined: Wed Feb 21, 2007 4:32 pm

Postby FI-DD » Tue Jun 10, 2008 7:58 pm

In latest_comments.php change this:
Code: Select all
$comments = $sql-> select(array('table' => 'comments',
                  'orderby' => array('date', 'DESC'),
                  'limit' => array(0, $number)));

   foreach ($comments as $comment){
            $comm_id = $comment['id'];
            $xid = $comment['post_id'];
            $author = $comment['author'];
$output = $template_active;
$output = str_replace('{id}', $xid, $output);
$output = str_replace('{author}', $author, $output);
$output = str_replace('{title}', get_title($xid,$max_length), $output);
$output = str_replace('{comment-id}', $comm_id, $output);
$strOUT .= $output . "\n";
}


to this:
Code: Select all
   $comments = $sql->select(array('table' => 'comments',
                  'orderby' => array('date', 'DESC')));
$i = 0;
foreach ($comments as $comment){
   if(!isset($found[$comment['post_id']]) and $i < $number){
      $comm_id = $comment['id'];
      $xid = $comment['post_id'];
      $author = $comment['author'];
      $output = $template_active;
      $output = str_replace('{id}', $xid, $output);
      $output = str_replace('{author}', $author, $output);
      $output = str_replace('{title}', get_title($xid,$max_length), $output);
      $output = str_replace('{comment-id}', $comm_id, $output);
      $strOUT .= $output . "\n";
      
      $found[$comment['post_id']] = true;
      $i++;
   }
   else{
      continue;
   }
}


(Not tested.)
Last edited by FI-DD on Fri Jun 20, 2008 1:37 pm, edited 1 time in total.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby flyboy17 » Tue Jun 10, 2008 8:13 pm

Hello FI-DD

Thanks, i just tested your code and it seems to work correct thanks :)
Except; when i delete a comment this plug-in still shows that reaction.
* I also used your 'fast' edition of this plug-in (code is slightly different i suppose)

Original:
Code: Select all
  $comments = $sql-> select(array('table' => 'comments',
                  'orderby' => array('date', 'DESC'),
                  'limit' => array(0, $number)));

   foreach ($comments as $comment){
            $comm_id = $comment['id'];
            $xid = $comment['post_id'];
            $get_news = reset($sql->select(array('table' => 'news', 'where' => array("id = ".$comment['post_id']))));
            $author = $comment['author'];
$output = $template_active;
$output = str_replace('{link}', cute_get_link($get_news), $output);
$output = str_replace('{author}', $author, $output);
$output = str_replace('{title}', get_title($xid,$max_length), $output);
$output = str_replace('{comment-id}', $comm_id, $output);
$output = str_replace('{date}', date("H:i", $comment['date']), $output);
$strOUT .= $output . "\n";
}


Install Instructions:
You might also want to edit editcomments.mdu so if you remove a comment the comment display will be
updated at same time. Look for the line that starts "msg('info', $echo['headerDeleted']," and
add latest_comments(10, 40); above it.
--> doesn't work anymore :(
flyboy17
 
Posts: 63
Joined: Wed Feb 21, 2007 4:32 pm

Postby FI-DD » Tue Jun 17, 2008 5:45 pm

Don't know. But I doubt that the changes I made are the reason for it not working anymore.

If you add that line in editcomments.mdu then the script checks the comments and puts them into the txt file. Since the comment is deleted it shouldn't be in the txt file anymore. Maybe it is a caching problem?
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby flyboy17 » Thu Jun 19, 2008 4:20 pm

I completly reinstall this plug-in with your change, but there are still double posts in the latest comments.
And also for some reason there is also a delay of 1 messages. (somewhere a wrong for-loop?)
Thanks for your help, i appreciate. :)
Attachments
ScreenShot055.jpg
(72.47 KiB) Downloaded 127 times
flyboy17
 
Posts: 63
Joined: Wed Feb 21, 2007 4:32 pm

Postby FI-DD » Fri Jun 20, 2008 1:37 pm

I made a small change in the code above. But I doubt that fixed it.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby flyboy17 » Sat Jun 21, 2008 11:33 pm

Hello

This one works fine thanks! :D
But still have a delay of 1 comment? :(
Any idea?
Thanks again :)
flyboy17
 
Posts: 63
Joined: Wed Feb 21, 2007 4:32 pm

Postby flyboy17 » Tue Jun 24, 2008 4:50 pm

Sorry to disturb you again :(
But now there URL is wrong.
I replaced the original in latest_comments.php
$output = str_replace('{link}', cute_get_link($get_news), $output);

but without any success (he just ignored the {link})

Template:
<a href="{link}#{comment-id}">{title}</a>


gives me:
http://www.flightlevel.be/#219


Normal link would be:
http://www.flightlevel.be/080619_rise-of-the-fuel-price-fall-of-the-airlines.html#219
flyboy17
 
Posts: 63
Joined: Wed Feb 21, 2007 4:32 pm

Postby FI-DD » Thu Jun 26, 2008 5:36 pm

Did you clear the cache?
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby flyboy17 » Thu Jun 26, 2008 9:57 pm

Yes i did :)
Also deleted the .txt file; so a new one should be created
flyboy17
 
Posts: 63
Joined: Wed Feb 21, 2007 4:32 pm

Postby flyboy17 » Thu Jul 17, 2008 5:01 pm

Any idees? :) thanks
flyboy17
 
Posts: 63
Joined: Wed Feb 21, 2007 4:32 pm

PreviousNext

Return to Additional Downloads



Who is online

Users browsing this forum: No registered users and 0 guests

cron