I am new to PHP.
I have a code to display an RSS feed but there is a big space between each item (the title/date and description).
Is it possible to eliminate those margins?
<?php
$feed = simplexml_load_file('http://online.wsj.com/xml/rss/3_7031.xml', 'SimpleXMLIterator');
$first3 = new LimitIterator($feed->channel->item, 0, 4);
foreach ($first3 as $item) {
echo "<h4><a href='$item->link'target='_blank'>$item->title</a></h4>";
preg_match('/(?:\w{3},\s)?\d{1,2}\s\w{3}\s\d{2,4}/', $item->pubDate, $m);
echo isset($m[0]) ? "<h5>$m[0]<h5>" : '';echo "<h6>$item->description<h6>";
}
?>
I’d create a stylesheet and change the margins on
h4,h5and other elements which may have or inherit margins.I’d recommending getting Firebug, then right clicking on the troublesome elements in Firefox and choosing Inspect Element from the context menu.
Then, on the right hand panel, select the Layout tab and have a visual look at the margins. If they are larger than you require, adjust via the CSS (you can also real time adjust using Firebug for some immediate feedback).
Then modify the CSS like so…