Hi,
When I pull news items from a RSS feed with MagpieRSS - RSS for PHP.
It seems cannot display the pound signs and quotation marks properly, for instance, it reads,
1. Anti-gay ?Nazi? slur causes Church of Scotland outrage
2. �16million 'Lord of Manor' gave all money to charity - Mirror.co.uk
Instead of,
1. Anti-gay 'Nazi' slur causes Church of Scotland outrage
2. £16million 'Lord of Manor' gave all money to charity
Is there any way I can get around to it?
Many thanks,
Lau
RSS feeds: pound signs and quotation marks
Moderator: General Moderators
-
lauthiamkok
- Forum Contributor
- Posts: 153
- Joined: Wed Apr 01, 2009 2:23 pm
- Location: Plymouth, United Kingdom
Re: RSS feeds: pound signs and quotation marks
How are you echoing out the titles?
-
lauthiamkok
- Forum Contributor
- Posts: 153
- Joined: Wed Apr 01, 2009 2:23 pm
- Location: Plymouth, United Kingdom
Re: RSS feeds: pound signs and quotation marks
this is the script that I use,divito wrote:How are you echoing out the titles?
Code: Select all
<?php
require_once 'magpierss/rss_fetch.inc';
$url = 'http://pipes.yahoo.com/pipes/pipe.run?_id=a39fa4f77e90609914ad4a1be7b07a9e&_render=rss';
$rss = fetch_rss($url);
$items = array_slice($rss->items, 0, 8);
foreach ($items as $item) {
$title = $item['title'];
$link = $item['link'];
$imageURL = $rss->image['url'];
$date = $item['date_timestamp'];
$desc = $item['description'];
$source = trim ($link, "http://");
$source = explode("/", $source);
$source = $source[0];
/*if (strlen($title) >= 50)
{
$title = substr($title,0,49)."...";
}
*/
$desc = eregi_replace('<br>',' ', $desc);
$desc = strip_tags($desc);
if (strlen($desc) >= 100)
{
$desc = substr($desc,0,99)."...";
}
?>
<!--item-->
<div class="item">
<!--item_left-->
<div class="item_left">
<?php if(!empty($imageURL))
{
?>
<div class="left_img"><img src="<?php echo $imageURL;?>"/></div>
<?php
}
?>
</div>
<!--item_left-->
<!--item_right-->
<div class="item_right">
<div class="title"><a href="<?php echo $link;?>" target="_blank"><?php echo $title;?></a></div>
<div class="desicription"><?php echo $desc;?></div>
<div class="date"><strong><?php echo date("j F", $date);?></strong>, <?php echo date("H:i", $date);?></div>
<div class="date">source: <a href="http://<?php echo $source;?>"><?php echo $source;?></a></div>
</div>
<!--item_right-->
</div>
<!--item-->
<?php
}
?>
Last edited by Benjamin on Fri May 15, 2009 9:24 am, edited 1 time in total.
Reason: Changed code type from text to php.
Reason: Changed code type from text to php.