Atom Feed Fix

April 08, 2005

Thanks to a comment by jayaram I discovered a bug with the way Atom feeds from Blogger.com feeds (maybe others) where handled (always displayed as full entries and full HTML). It seems like an obvious goof!

An adjustment in the logic of feed2js.php has been made. either download the new files or make the following modification. Change the lines that read:
if ($item['summary']) {
	$my_blurb = $item['summary'];

	// strip html
	if ($html != 'a') $my_blurb = strip_tags($my_blurb);
	
	// trim descriptions
	if ($desc > 1) {
	
		// display specified substring numbers of chars;
		//   html is stripped to prevent cut off tags
		$my_blurb = substr($my_blurb, 0, $desc) . '...';
	}

} else {    // Atom support (thanks David Carter-Tod)
	$my_blurb = $item['content']['encoded'];
}

to read:
if ($item['summary']) {
    $my_blurb = $item['summary'];

} else {    // Atom support (thanks David Carter-Tod)
    $my_blurb = $item['content']['encoded'];
}

// strip html
if ($html != 'a') $my_blurb = strip_tags($my_blurb);

// trim descriptions
if ($desc > 1) {

    // display specified substring numbers of chars;
    //   html is stripped to prevent cut off tags
    $my_blurb = substr($my_blurb, 0, $desc) . '...';
}

Write a comment










Remember personal info?





Spam Prevention Security Code: Enter the numbers you see in the image above