Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: New comments not showing  (Read 9393 times)

evilicy

  • Newbie
  • *
  • Karma: 0
  • Posts: 7
    • DarkVoid Poetry
New comments not showing
« on: September 05, 2008, 06:45:14 AM »

On the side panel under the heading "New Comments" nothing shows up when new comments are posted. Although the comments themselves do show under the articles.
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: New comments not showing
« Reply #1 on: September 05, 2008, 08:11:14 AM »

They do on my RC... have you edited the indexfile by any chance and removed that from it ?
Logged
"It's only dead fish that goes with the flow... "
Updated

evilicy

  • Newbie
  • *
  • Karma: 0
  • Posts: 7
    • DarkVoid Poetry
Re: New comments not showing
« Reply #2 on: September 05, 2008, 07:36:12 PM »

Nope the only thing I edited was the snews.php to add my database info and the style.css to change some colors around.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: New comments not showing
« Reply #3 on: September 05, 2008, 10:17:26 PM »

Check inside your index.php file and see if you have this line - <?php new_comments(5, 30); ?>
If you do, then you should have comment lead-ins displaying... provided you have some comments.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

evilicy

  • Newbie
  • *
  • Karma: 0
  • Posts: 7
    • DarkVoid Poetry
Re: New comments not showing
« Reply #4 on: September 05, 2008, 10:29:36 PM »

Yep it is there.... and there are 2 comments under a article but none there.

My site is http://Steven.DarkVoid.org if that helps. If you need any additional information that might help please let me know.
Logged

evilicy

  • Newbie
  • *
  • Karma: 0
  • Posts: 7
    • DarkVoid Poetry
Re: New comments not showing
« Reply #5 on: September 05, 2008, 10:57:07 PM »

Okay I did that and showed this:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/content/p/e/a/peacefrog/html/steven/snews.php on line 924

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/p/e/a/peacefrog/html/steven/snews.php on line 929
« Last Edit: September 05, 2008, 11:09:11 PM by evilicy »
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: New comments not showing
« Reply #6 on: September 05, 2008, 11:43:10 PM »

could you please post here your
function new_comments
Logged
Of all the things I have lost, it is my mind that I miss the most.

evilicy

  • Newbie
  • *
  • Karma: 0
  • Posts: 7
    • DarkVoid Poetry
Re: New comments not showing
« Reply #7 on: September 05, 2008, 11:44:49 PM »

Here it is
Code: [Select]
// NEW COMMENTS
function new_comments($number = 5, $stringlen = 30) {
$query = '
SELECT
(SELECT
count(articleid)
FROM '._PRE.'comments
WHERE articleid= a.id ) AS num,
a.id AS aid,title,a.seftitle AS asef,category,
co.id,articleid,co.name AS coname,comment,
c.name,c.seftitle AS csef,c.subcat,
x.name,x.seftitle AS xsef
FROM '._PRE.'comments AS co
LEFT OUTER JOIN '._PRE.'articles AS a
ON articleid = a.id
LEFT OUTER JOIN '._PRE.'categories AS c
ON category = c.id
LEFT OUTER JOIN '._PRE.'categories AS x
ON c.subcat = x.id
WHERE a.published = 1
AND (c.published ="YES" || c.published IS NULL)
AND (x.published ="YES" || x.published IS NULL)
AND approved = "True" ORDER BY co.id DESC LIMIT '.$number;
$result = mysql_query($query);
if (mysql_num_rows($result) === 0) {echo '<li>'.l('no_comments').'</li>';}
else {
$comlim = s('comment_limit');
$comment_limit = $comlim < 1 ? 1 : $comlim;
$comments_order = s('comments_order');
while ($r = mysql_fetch_array($result)) {
$ordinal = $r['num'];
$name = $r['coname'];
$comment = strip_tags($r['comment']);
$page = ceil($ordinal / $comment_limit);
$ncom = $name.' ('.$comment;
$ncom = strlen($ncom) > $stringlen ? substr($ncom, 0, $stringlen - 3).'...' : $ncom;
$ncom.= strlen($name) < $stringlen ? ')' : '';
$ncom = str_replace(' ...', '...', $ncom);
$paging = $page > 1 ? '/'.$page : '';
if ($r['category'] == 0) {$link = $r['asef'];}
else {$link = isset($r['xsef']) ? $r['xsef'].'/'.$r['csef'] : $r['csef']; $link .= '/'.$r['asef'];}
echo '<li><a href="'.db('website').$link.$paging.'/#'.l('comment').$ordinal.'" title="'.l('comment_info').' '.$r['title'].'">'.$ncom.'</a></li>';
}}}
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: New comments not showing
« Reply #8 on: September 06, 2008, 12:00:44 AM »

ok, now I would like to see your output of the $query.

place echo  in front of $query=

ie, make it

echo $query='

then run it, and copy/paste the text that should now be displayed...
Logged
Of all the things I have lost, it is my mind that I miss the most.

evilicy

  • Newbie
  • *
  • Karma: 0
  • Posts: 7
    • DarkVoid Poetry
Re: New comments not showing
« Reply #9 on: September 06, 2008, 12:17:04 AM »

Here it is:

SELECT (SELECT count(articleid) FROM gill_comments WHERE articleid= a.id ) AS num, a.id AS aid,title,a.seftitle AS asef,category, co.id,articleid,co.name AS coname,comment, c.name,c.seftitle AS csef,c.subcat, x.name,x.seftitle AS xsef FROM gill_comments AS co LEFT OUTER JOIN gill_articles AS a ON articleid = a.id LEFT OUTER JOIN gill_categories AS c ON category = c.id LEFT OUTER JOIN gill_categories AS x ON c.subcat = x.id WHERE a.published = 1 AND (c.published ="YES" || c.published IS NULL) AND (x.published ="YES" || x.published IS NULL) AND approved = "True" ORDER BY co.id DESC LIMIT 5
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: New comments not showing
« Reply #10 on: September 06, 2008, 12:39:25 AM »

tell you what... since there must be something clashing in the sql, and your server or something like that, try this version of the function (it is a later version from a not-as-yet-public snews.php)
Code: [Select]
// NEW COMMENTS
function new_comments($number = 5, $stringlen = 30) {
$query =
'SELECT
a.id AS aid,title,a.seftitle AS asef,
category,co.id,articleid,co.name AS coname,comment,
c.name,c.seftitle AS csef,c.subcat,
x.name,x.seftitle AS xsef
FROM '._PRE.'comments AS co
LEFT OUTER JOIN '._PRE.'articles AS a
ON articleid = a.id
LEFT OUTER JOIN '._PRE.'categories AS c
ON category = c.id AND c.published =\'YES\'
LEFT OUTER JOIN '._PRE.'categories AS x
ON c.subcat = x.id AND x.published =\'YES\'
WHERE a.published =1
AND approved = \'True\'
ORDER BY co.id DESC LIMIT '.$number;

$result = mysql_query($query);
if (mysql_num_rows($result) === 0) {
echo '<li>'.l('no_comments').'</li>';
} else {
$comlim = s('comment_limit');
$comment_limit = $comlim < 1 ? 1 : $comlim;
$comments_order = s('comments_order');
while ($r = mysql_fetch_array($result)) {
$loopr = mysql_query("SELECT id FROM ".db('prefix')."comments
WHERE articleid = '$r[articleid]'
AND approved = 'True'
ORDER BY id $comments_order");
$num = 1;
while ($r_art = mysql_fetch_array($loopr)){
if ($r_art['id'] == $r['id']) { $ordinal = $num; }
$num++;
}
$name = $r['coname'];
$comment = strip_tags($r['comment']);
$page = ceil($ordinal / $comment_limit);
$ncom = $name.' ('.$comment;
$ncom = strlen($ncom) > $stringlen ? substr($ncom, 0, $stringlen - 3).'...' : $ncom;
$ncom.= strlen($name) < $stringlen ? ')' : '';
$ncom = str_replace(' ...', '...', $ncom);
$paging = $page > 1 ? '/'.$page : '';
$link = isset($r['xsef']) ? $r['xsef'].'/'.$r['csef'] : $r['csef']; $link .= '/'.$r['asef'];
echo '<li><a href="'._SITE.$link.$paging.'/#'.l('comment').$ordinal.'"
title="'.l('comment_info').' '.$r['title'].'">'.$ncom.'</a>
</li>';
}}}
« Last Edit: September 06, 2008, 12:47:04 AM by philmoz »
Logged
Of all the things I have lost, it is my mind that I miss the most.

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: New comments not showing
« Reply #11 on: September 06, 2008, 12:54:25 AM »

Here it is:

SELECT (SELECT count(articleid) FROM gill_comments WHERE articleid= a.id ) AS num, a.id AS aid,title,a.seftitle AS asef,category, co.id,articleid,co.name AS coname,comment, c.name,c.seftitle AS csef,c.subcat, x.name,x.seftitle AS xsef FROM gill_comments AS co LEFT OUTER JOIN gill_articles AS a ON articleid = a.id LEFT OUTER JOIN gill_categories AS c ON category = c.id LEFT OUTER JOIN gill_categories AS x ON c.subcat = x.id WHERE a.published = 1 AND (c.published ="YES" || c.published IS NULL) AND (x.published ="YES" || x.published IS NULL) AND approved = "True" ORDER BY co.id DESC LIMIT 5

Guys, this will be very hard to understand and debug :P ... I think the new version of sNews will make another selection on sNews adept population....
Logged

evilicy

  • Newbie
  • *
  • Karma: 0
  • Posts: 7
    • DarkVoid Poetry
Re: New comments not showing
« Reply #12 on: September 06, 2008, 01:23:17 AM »

tell you what... since there must be something clashing in the sql, and your server or something like that, try this version of the function (it is a later version from a not-as-yet-public snews.php)

Thanks that works :)
Logged

Joost

  • Guest
Re: New comments not showing
« Reply #13 on: September 06, 2008, 04:23:51 AM »

Guys, this will be very hard to understand and debug :P ... I think the new version of sNews will make another selection on sNews adept population....
Based on a query? You think someone will print a query to the screen and say "I don't understand this query and therefore I am not going to use sNews"?  ???
Most people who use cms, don't care about code.
Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: New comments not showing
« Reply #14 on: September 06, 2008, 07:08:53 PM »

Most people who use cms, don't care about code.

Yes, you're right, for them, does not matter what is under hood if car is faster and stable... I did not referred them...  "Northern European technology" is very good but extremely complicate :P, not too god for custom area :P (at my level).
Logged
Pages: [1] 2