Page 1 of 1

fix for functions_rss.inc.php

Posted: Sat Jul 22, 2006 11:58 pm
by stm999999999
Hello,

while working on making comments AND trackbacks rss-feedable, I found a little thing to fix:

Code: Select all

if ($options['comments'] == true) {
// Display username as part of the title for easier feed-readability
     $entry['title'] = $entry['author'] . ': ' . $entry['title'];
}

normal it makes "name: title"

If there is no author-name (=anonym), these code still make an ":" before the title, so it results in ": title" :-(


my fix:

Code: Select all

if ( ($options['comments'] == true)  AND ($entry['author'] != '') ) {
    // Display username as part of the title for easier feed-readability
           $entry['title'] = $entry['author'] . ': ' . $entry['title'];
}

Posted: Mon Jul 24, 2006 12:45 am
by stm999999999
OK, working on s9y I learned, that there is a theme-indipendant const for anonym comment authors.

So, these code would be better:

Code: Select all

if ( ($options['comments'] == true)  AND ($entry['author'] != '') ) { 
    // Display username as part of the title for easier feed-readability 
           $entry['title'] = $entry['author'] . ': ' . $entry['title']; 
} elseif ($options['comments'] == true) {
     // Display anonymous as part of the title for easier feed-readability
         $entry['title'] = $CONST.ANONYMOUS . ': ' . $entry['title'];
}

Posted: Mon Jul 24, 2006 10:35 am
by garvinhicking
Hi!

Thanks, fix committed (although in a slighty different style). Next time it would also help if you mention the filename where to fix this ;-)

Best regards and thanks,
Garvin

Posted: Mon Jul 24, 2006 2:21 pm
by stm999999999
Look at the title of the post! :-)

Posted: Mon Jul 24, 2006 4:19 pm
by garvinhicking
Oops. Who reads titles anyways ;)

Posted: Mon Jul 24, 2006 4:27 pm
by stm999999999
Someone who reads BILD and bites little children? :D

Posted: Tue Jul 25, 2006 1:50 am
by stm999999999
Thanks, fix committed (although in a slighty different style).
I see:

Code: Select all

$entry['title'] = (!empty($entry['author']) ? $entry['author'] : ANONYMOUS) . ': ' . $entry['title'];
Is this the same as $CONST.ANONYMOUS?

Posted: Tue Jul 25, 2006 11:19 am
by garvinhicking
Hi!

$CONST.ANONYMOUS does not exist in PHP space, only in Smarty space. :)

In PHP it would need to read $CONST['ANONYMOUS'], but this also doesn'T exist, because "ANONYMOUS" is a constant, and is thus accessed without $ and . :)

Best regards,
Garvin

Posted: Thu Jul 27, 2006 8:52 pm
by stm999999999
garvinhicking wrote:Hi!

$CONST.ANONYMOUS does not exist in PHP space, only in Smarty space. :)
Hm, why did it worked for me?

Posted: Fri Jul 28, 2006 1:06 pm
by garvinhicking
Hi!

Because "." is the concatenation character. Thus, the output first returned $CONST and then joined the "ANONYMOUS" constant next to it. Since $CONST is an unset variable, this returned an empty string, and the constant ANONYMOUS returned the proper variable.

It's quite funny, now that I think of it. :)

Best regards,
Garvin