Page is a not externally linkable
penders - 9:23 am on Sep 9, 2011 (gmt 0)
I thought it was odd when Readie said to build it at the top.
But that is correct, or "as the first thing on the page" - same thing. "build" in this sense means to "assign values to". The "page" is the entire document, not just the visual page.
So, reordering your code and adding back rocknbil's $files...
<?php
/**
* 1. Declare/initialise your variables
* Or at least the ones that *need* to be initialised
*/
$articles = array();
$files = array();
/**
* 2. Assign values to your variables
*/
$rss = new SimpleXMLElement("http://$fqdn/rss/FreeDownloads.xml", null, true);
foreach($rss->xpath("channel/item") as $item) {
$articles[] = $item->title;
$files[] = basename($item->guid,".xml");
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<pre>
<?php
/**
* 3. Output
*/
print_r($articles);
print_r($files);
?>
</pre>
</body>
</html>