Having an issue within the <description> node, it contains a header line and then followed by <![CDATA[ story paragraph [/size]]]>.
How to create another variable for everything inside the CDATA? and/or how to remove that entirely? Thanks in advance.
//this remove all a href from rawdata
$rawdata = preg_replace('@<a href=[^>]+>(.*)</a>@', '', $rawdata);
$rawdata = preg_replace('/<pre>/', '', $rawdata);
$rawdata = preg_replace('/<\/pre>/', '', $rawdata);
$rss_update = preg_match_all("/<pubDate>(.*)<\/pubDate>/", $rawdata, $rss_update);
$types = array(
'link',
'description',
'title',
'pubDate',
'author');
$valid = array();
$link = $description = $title = $pubDate = $author = array();
$rawdata = preg_replace('/<item>/', "<item>\s", $rawdata);
if (preg_match_all('/<item>(.+?)<\/item>/s', $rawdata, $r))
{
$rr = count($r[0]);
for ($i = 0; $i < $rr; $i++)
{
if (preg_match_all('/<(.+?)>(.+?)<\//s', $r[1][$i], $y))
{
$yy = count($y[0]);
for ($x = 0; $x < $yy; $x++)
{
if (in_array($y[1][$x], $types))
{
array_push(${$y[1][$x]}, $y[2][$x]);
}
}
}
}
}
if ($this->debug)
echo "rss total $i\n";
$this->smarty->assign('rss_update', $rss_update);
$this->smarty->assign('rss_link', $link);
$this->smarty->assign('rss_description', $description);
$this->smarty->assign('rss_title', $title);
$this->smarty->assign('rss_pubdate', $pubDate);
$this->smarty->assign('rss_author', $author);
$this->smarty->assign('rss_story', $story);
$this->smarty->assign('rss_total', $i);