the itjerk

my adventures with technology

Tag Archives: rock

album of the day in php & xml

     // load the xml file 
	    trigger_error('Error reading XML file',E_USER_ERROR);
    // generate a random number each day
	$today = date("Ymd");
	srand($today / pi());
	$max = count($xml->event) - 1 ;
	$num = rand (0,$max);
    // display random record with attributes
	echo "<span class=head>";	
	echo 'Album of the Day:<br />';
	echo $xml->event[$num]->attributes()->title;
	echo "<br />";
	echo "[html:img src=";
	echo $xml-]event[$num]->attributes()->image; 
	echo " width=150 height=150>";
	echo "<br />";
    //	convert from utf-8 to iso8859-1
	$review = iconv( "UTF-8", "ISO-8859-1//TRANSLIT", $xml->event[$num]);
	echo "<span class=item>";
    	echo $review	

On the web: