-2

I've got an RSS XML Displayer which gets elements with a for loop from an XML Rss feed as follows:

//get and output "<item>" elements
$x=$xmlDoc->getElementsByTagName('item');

//iterate though all of the feed 

for ($i=0; $i<=$x->length-1; $i++) {
    echo ("<div class='boxed'>");
  $item_title=$x->item($i)->getElementsByTagName('date')
  ->item(0)->childNodes->item(0)->nodeValue;
  $item_link=$x->item($i)->getElementsByTagName('location')
  ->item(0)->childNodes->item(0)->nodeValue;
  $item_desc=$x->item($i)->getElementsByTagName('report')
  ->item(0)->childNodes->item(0)->nodeValue;
  echo ("<p><a href='" . $item_link
  . "'>" . $item_title . "</a>");
   echo ("</div>");
  echo ("<br>");

  echo ($item_desc . "</p>");
}

?>

I'd like to modify this using css so each element is seperated in a 'box' via CSS. I'm sure this is possible but cannot figure out how to do it. The CSS intuitively needs to be implemented within the for loop. How to implement that?

Edit:

I've done away with this completely and am using jQuery with CSS to implement what I want.

Ahmed Zafar
  • 665
  • 2
  • 10
  • 24

1 Answers1

0

You want this:

echo '<a href="'.$item_link.'" style="display:inline-block; 
                                          width:200px;
                                          height:200px;">
         '.$item_title.'
         </a>';

You can insert your own css class or code in the <a> tag.

user1735921
  • 1,359
  • 1
  • 21
  • 46