PHP to pull from XML document
Posted: Tue Jul 15, 2008 12:45 am
Does anyone have any suggestion on how to modify the following so it will pull the file names from an XML file so I can update the XML file instead of the PHP file? Hopefully that makes sense.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
$files = array(
0 => 'test1.php',
1 => 'test2.php',
2 => 'test3.php'
);
$index = array_rand($files);
include($files[$index]);
?>
<body>
</body>
</html>