Loading ...
Sorry, an error occurred while loading the content.
 

Re: lastRSS - unable to get CDATA and enclosure image

Expand Messages
  • Hasin Hayder
    Hi, why dont u use existing sax or dom api which is builtin for PHP? as far as I know, last RSS is optimized for RSS .90, RSS 1.0, RSS2.0 and Atom. And I am
    Message 1 of 2 , Nov 28, 2005
      Hi,

      why dont u use existing sax or dom api which is builtin for PHP? as
      far as I know, last RSS is optimized for RSS .90, RSS 1.0, RSS2.0 and
      Atom. And I am quite confused whether it actually care about CDATA
      or not..

      I suggest you to use SimpleXML API which parse all your xml and output
      it into an associative array. Lets try.

      --Hasin

      --- In phpexperts@yahoogroups.com, "flo_urlaub"
      <flo-is-im-urlaub@g...> wrote:
      >
      > Hi all,
      >
      > i use LastRSS (http://lastrss.webdot.cz/) to parse the following xml
      > file.
      > $item['description'] or $item['title'] work fine, but iam unable to
      > get the content of CDATA or the URL inside the
      > enclosure tag shown in my news.php :(
      >
      > i tried $item['enclosure'] and $item['content'], but without success.
      >
      > Can you help me plz?
      >
      > thx, florian
      >
      > -----------XML-------------
      > - <item>
      > <title>test</title>
      > <link>url.xml</link>
      > <description>this is just a demo.</description>
      > <category>test</category>
      > <enclosure url=="http://example.com/dog.jpg" type=="image/jpeg"
      > length=="745017" />
      > <pubDate>Wed, 16 Nov 2005 23:00:00 GMT</pubDate>
      > <dc:creator>Mr. Creator</dc:creator>
      > - <content:encoded>
      > - <![CDATA[
      >
      > // html code...
      >
      > ]]>
      > </content:encoded>
      > </item>
      > -----------XML-------------
      >
      >
      > my php file looks like this:
      >
      >
      > -----------News.php-------------
      >
      > <?php
      > // config
      > include "./XMLParser.php";
      > $rss == new lastRSS;
      > $rss->cache_dir == './temp'; // chmod 777
      > $rss->cache_time == 1200;
      >
      > // url
      > if ($rs == $rss->get('example.php')) {
      >
      > // output
      >
      > echo "<table width==\"610\" border==\"0\" cellspacing==\"0\"
      > cellpadding==\"10\">";
      >
      > foreach($rs['items'] as $item) {
      >
      > echo "\t
      > <tr><td colspan==2 class==header>" . $item
      > ['title'] . "</td></tr>
      > <tr><td class==bilder><img src==" . $item
      > ['enclosure'] . "></td>
      > <td>" . $item['description'] . "<a href==$item
      > [link]>read more</a> " . $item['content'] . "</td></tr>
      >
      > \n"; } } else { echo "Error\n"; }
      >
      > echo "</table>";
      >
      > ?>
      >
      > -----------News.php-------------
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.