Home - Nieuws - Diensten - Adressen - Lid worden
   

KSJ Brabant


Gebruik dit stukje php-code om links op je website te plaatsen.
<?php
function object2array($object){
$return = NULL;

if(is_array($object)){
	foreach($object as $key => $value)
	$return[$key] = object2array($value);
}else{
	$var = get_object_vars($object);

if($var){
	foreach($var as $key => $value)
	$return[$key] = ($key && !$value) ? NULL : object2array($value);
	}
	else return $object;
	}
return $return;
}


$today = date("Ymd");
$xml = simplexml_load_file("http://ksanet.be/xml/ksa2.xml?a=$today");
if (!$xml){exit("Failed to open ksa2.xml.<br />");}

$myarray = object2array($xml);

$num_marker = count($myarray['ksa2']['marker']);

echo "<table class=\"snsample\">\n";
for($i = 0; $i < $num_marker; $i++) {
if (($myarray['ksa2']['marker'][$i]['@attributes']['domain']!='nodomain')&&($myarray['ksa2']['marker'][$i]['@attributes']['domain']!='')){
	$mylink="<a href='http://www.{$myarray['ksa2']['marker'][$i]['@attributes']['domain']}'>".utf8_decode($myarray['ksa2']['marker'][$i]['@attributes']['groupname'])."</a>";
}else{
	$mylink="<a href='http://{$myarray['ksa2']['marker'][$i]['@attributes']['name']}.ksanet.be'>".utf8_decode($myarray['ksa2']['marker'][$i]['@attributes']['groupname'])."</a>";
}
if ($myarray['ksa2']['marker'][$i]['@attributes']['groupID']!=''){
	$mygroupID='['.$myarray['ksa2']['marker'][$i]['@attributes']['groupID'].']';
}else{
	$mygroupID='';
}

echo "<tr><td>$mylink</td><td>$mygroupID</td><td>".utf8_decode($myarray['ksa2']['marker'][$i]['@attributes']['city'])."</td></tr>\n";
}
echo "</table>\n";
?>



Dit is het resultaat:

Failed to open ksa2.xml.