i just started using phpwcms and i already love it
anyway here is my way to insert xml in to my page.
i tought i could share it with you guys&girls
Code: Select all
<?php
$newsfeed = 'http://some-xml-or-rss-link.xml';
$fp = @fopen($newsfeed, 'r');
while(!feof($fp)){
$row .= @fgets($fp, 4096);
}
@fclose($fp);
if( eregi('<item>(.*)</item>', $row, $rowitem ) ) {
$item = explode('<item>', $rowitem[0]);
for( $i = 0; $i < count($item) - 1; $i++ ) {
eregi('<title>(.*)</title>', $item[$i+1], $title );
eregi('<link>(.*)</link>', $item[$i+1], $url );
eregi('<description>(.*)</description>', $item[$i+1], $description);
eregi('<title>(.*)</title>', $item[$i+1], $title2 );
$title[1]= substr ($title[1], 0, 25);
echo "<table cellpadding=0 cellspacing=0><tr>";
echo "<td>";
echo '<a href="' . $url[1] . '" title="' . $title2[1] . '">' . $title[1] . '</a><br />';
echo "</td></tr>";
echo "</table>";
}
}
?>
just make a file with a name like xml.php or something and import with
Code: Select all
{PHP:xml.php}
greetz,
Passie