Wednesday 27th February 2008XML to PHP
This is a very simple script that passes xml to php.
Parse XML to PHP and use the data on your very own website. You can also use this code to include RSS news feeds.
This is a simple example of how to include the xml parser:
<?php
include 'xmltophp.class.php';$files = array('rss.xml');
$xmlToPHP = new xmlToPHP;
foreach ($files as $file) {
$x = $xmlToPHP->outputHTML($file);
foreach ($x as $y => $z) {
echo '<b>'.$z['title'].'</b><div>'.$z['description'].'</div><br />';
}
}
?>
Include the class, specify the files you would like to use. Then do a simply loop and grab all the data. You will need to download the xmltophp.class.php file and store it in the directory you specify in the $files variable below.
28.10.07
Added support for remote files.
can you use pagination with this?.... if so, can someone give an example please?
June 15th, 2008 at 12:14 pm