Hello,
I recently started coding in PHP, version 5 to be exact, and for my second project I learned that our server only has version 4.3 installed. I can't seem to find the right article/resource/tutorial to show me how to change code from 5 to 4.
All I am doing is loading an XML file and outputting the results in a list; here is version 5
<?php
$xmlFile = "File.xml";
$doc = new DOMDocument();
$doc->load($xmlFile);
?>
<html>
<head>
</head>
<body>
<div id="bkgroundContainer">
<div id="contentContainer">
<?php
# WRITE MENU
echo "<ol class=\"menu\">\n";
$element = $doc->getElementsByTagName( "btn" );
foreach( $element as $btn )
{
$names = $btn->getElementsByTagName( "name" );
$urls = $btn->getElementsByTagName( "url" );
$name = $names->item(0)->nodeValue;
$url = $urls->item(0)->nodeValue;
echo "<li><a href=\"" . $url . "\">" . $name . "</a></li>\n";
}
echo "</ol>\n";
# WRITE FEEDS
echo "<ol class=\"feeds\">\n";
$element = $doc->getElementsByTagName( "content" );
foreach( $element as $feed )
{
$heads = $feed->getElementsByTagName( "head" );
$bodys = $feed->getElementsByTagName( "body" );
$urls = $feed->getElementsByTagName( "url" );
$head = $heads->item(0)->nodeValue;
$body = $bodys->item(0)->nodeValue;
$url = $urls->item(0)->nodeValue;
echo "<li><a href=\"" . $url . "\"><span class=\"bold\">" . $head . "</span><br/>" . $body . "</a></li>\n";
}
echo "</ol>\n";
?>
</div>
</div>
</body>
</html>
Can you point me how I re-write this in version 4?