Jump to content

PHP Script - RSS feed / Code now not validating !!


Recommended Posts

Hi,

 

I have a PHP script that is pulling in relevant RSS feeds to the 'News' page on a site, not sure what is causing it, i have had a play about, but basically the XHTML code is now not validating as it has an abundance of br tags littered around..help greatly appreciated

 

here is a snippet of the PHP displaying the feeds .........

 

function display_feed($data)
    {
      extract($data);
      if($TITLE) {
        $this->retval .= "<h1>";
        if($LINK) $this->retval .= "<a href=\"$LINK\" target=\"_blank\">";
        $this->retval .= stripslashes($TITLE);
        if($LINK) $this->retval .= "</a>";
        $this->retval .= "</h1>\n";
        if($TAGLINE) $this->retval .= "<P>" . stripslashes($TAGLINE) . "</P>\n\n";
        $this->retval .= "<div class=\"divider\"><!-- --></div>\n\n";
      }
      if($ENTRY) {
        foreach($ENTRY as $item) $this->display_entry($item, "FEED");
      }
    }


    function display_entry($data, $parent)
    {
      extract($data);
      if(!$TITLE) return;

      $this->retval .=  "<P><B>";
      if($LINK) $this->retval .=  "<a href=\"$LINK\" target=\"_blank\">";
      $this->retval .= stripslashes($TITLE);
      if($LINK) $this->retval .= "</a>";
      $this->retval .=  "</B>";
      if($ISSUED) $this->retval .= " <small>($ISSUED)</small>";
      $this->retval .=  "</P>\n";

      if($AUTHOR) {
        $this->retval .=  "<P><b>Author:</b> " . stripslashes($AUTHOR['NAME']) . "</P>\n\n";
      }
      if($CONTENT) {
        $this->retval .=  "<P>" . stripslashes($CONTENT) . "</P>\n\n";
      } elseif($SUMMARY) {
        $this->retval .=  "<P>" . stripslashes($SUMMARY) . "</P>\n\n";
      }

 

and here is the XHTML that is seen when viewing the source, which once validated...but not anymore !!

 

<h1>Whiplash Related News</h1>

   

   

<p>'Black boxs to be fitted to young drivers cars to tackle accidents'<br><a href='information/black-boxs-to-be-fitted-to-young-drivers-cars-to-tackle-accidents.html'>Read More</a><br><br>
'Surfer suffers whiplash and brain injury'<br><a href='information/surfer-suffers-whiplash-and-brain-injury.html'>Read More</a><br><br><br><br> </p>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.