2011-06-18, 20:12:47
@mvlcek:
I see you are using a global variable inside your implementation, why? You can do this without leaking any data into the global scoop, that way you don’t have to bother with back-upping any already existing variables either.
This works just as well: (large bit of code directly from the GS core)
And can be used like this, in a template:
and with a component called credits:
Please stay out of the global scoop unless you need to communicate with global data.
--- --- --- --- ---
The big question for this topic to answer is: should this be implemented in the core?
I see you are using a global variable inside your implementation, why? You can do this without leaking any data into the global scoop, that way you don’t have to bother with back-upping any already existing variables either.
This works just as well: (large bit of code directly from the GS core)
Code:
function get_component_args($id) {
if (func_num_args() > 1) { $args = func_get_args(); array_shift($args); }
if (file_exists(GSDATAOTHERPATH.'components.xml')) {
$data = getXML(GSDATAOTHERPATH.'components.xml');
$components = $data->item;
if (count($components) != 0) {
foreach ($components as $component) {
if ($id == $component->slug) {
eval("?>" . strip_decode($component->value) . "<?php ");
}
}
}
}
}
Code:
get_component_args('credits','Zegnåt','http://zegnat.net/');
Code:
<p>Build by <a href="<?php echo $args[1]; ?>"><?php echo $args[0]; ?></a></p>
--- --- --- --- ---
The big question for this topic to answer is: should this be implemented in the core?
“Don’t forget the important ˚ (not °) on the a,†says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!