2011-06-06, 04:25:48
To not use $GLOBALS:
Code:
$components = null;
function get_component($id) {
global $components;
if (!$components) {
if (file_exists(GSDATAOTHERPATH.'components.xml')) {
$data = getXML(GSDATAOTHERPATH.'components.xml');
$components = $data->item;
} else {
$components = array();
}
}
if (count($components) > 0) {
foreach ($components as $component) {
if ($id == $component->slug) {
eval("?>" . strip_decode($component->value) . "<?php ");
}
}
}
}