div automatically added in $item->get_description(); using simplepie
Posted
by
Carey Estes
on Stack Overflow
See other posts from Stack Overflow
or by Carey Estes
Published on 2012-06-06T20:07:38Z
Indexed on
2012/06/20
15:16 UTC
Read the original article
Hit count: 316
I am getting a div that is appearing in the output from calling a RSS feed. It is ignoring my attempts to wrap it in a paragraph tag and pushes the data out to the div.
foreach ($feed->get_items(0 , 3) as $item):
$feedDescription = $item->get_content();
$image = returnImage($feedDescription);
$image = scrapeImage($image);
$image_url= $item->get_permalink();
$description = $item->get_description();
?>
<div class="item">
<h4><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h4>
<div class="image-box"><?php echo '<a href="' . $image_url . '"><img src="' . $image . '" /></a>'."\n";?></div>
<p><?php echo $description ?></p>
<p><a href="<?php echo $item->get_permalink(); ?>">Continue Reading</a></p>
</div>
<?php endforeach; ?>
Here is the html output:
<div class="item">
<h4><a href="#">Lorem Ipsum</a></h4>
<div class="image-box"><a href="#"><img src="image.jpg"></a>
</div>
<p></p>
<div>Lorem Ipsum description [...]</div>
<p></p>
<p><a href="#">Continue Reading</a></p>
</div>
Why does the description call add a div tag and not get wrapped in the paragraph tag?
© Stack Overflow or respective owner