PDA

View Full Version : RSS feed displaying "'"



toolman
12-14-2007, 03:59 PM
Hi there,

I hav installed the RSS Display Boxes:

http://www.dynamicdrive.com/dynamicindex18/rssdisplaybox/index.htm

but for some reason, the titles are displaying '
For example:

Hairdressing 'not just for girls'

Any ideas how I can remove these?

Thanks!

ddadmin
12-15-2007, 09:29 AM
' is a XML entity for quotes I believe. The problem most likely is due to Simplepie skipping it among the characters it should decode.

Inside main.php, the below line is what outputs the actual contents of each RSS entry to be shown:


outputbody($item, $templatename); //call custom outputbody() function

You can try doing a search and replace of ', and replacing that with a normal single quote:


preg_replace(/'/, "'", outputbody($item, $templatename)); //call custom outputbody() function

Untested, but that's the general idea at least.

toolman
12-17-2007, 04:15 PM
Thanks, but when I paste it into the main.php file, the RSS feeds don't seem to show up. Am I placing it in the correct file?



preg_replace(/'/, "'", outputbody($item, $templatename)); //call custom outputbody() function

Reston789
01-10-2008, 11:12 PM
I had this problem and ended up using the PHP str_replace function in outputbody.php - I'm just using the default template which I changed as follows:

if ($template=="" || $template=="default"){ //DEFAULT TEMPLATE
?>
<DIV class="rsscontainer">
<div class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>"><?php echo str_replace("&apos;", "'", $item->get_title()); ?></a></div>
<div class="rssdate"><?php echo $item->get_date('d M Y g:i a'); ?></div>
<div class="rssdescription"><?php echo str_replace("&apos;", "'", $item->get_description()); ?></div>
</DIV>
<?
} //end default template

This seems to deal with the problem with &apos; no longer appearing in the titles and descriptions. However, I'm no PHP expert and there may be a better way.

Works for me though - maybe it'll help you out.