fix for functions_rss.inc.php

Discussion corner for Developers of Serendipity.
Post Reply
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

fix for functions_rss.inc.php

Post 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'];
}
Ciao, Stephan
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post 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'];
}
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

Look at the title of the post! :-)
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Oops. Who reads titles anyways ;)
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

Someone who reads BILD and bites little children? :D
Ciao, Stephan
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post 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?
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

garvinhicking wrote:Hi!

$CONST.ANONYMOUS does not exist in PHP space, only in Smarty space. :)
Hm, why did it worked for me?
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply