value1 value2 value3 value11 value12 value13 * */ /* //Utilisation: require_once("$class_path/parameters_subst.class.php"); $parameter_subst = new parameters_subst('fichier.xml', $id); $parameter_subst->extract(); */ class parameters_subst { public $values = array(); public function __construct($fichier, $id) { if (!file_exists($fichier)) return; $file_content = file_get_contents($fichier); $parsed_file = _parser_text_no_function_($file_content); if (!isset($parsed_file["PARAMETERS_LIST"][0]["PARAMETERS"])) return; foreach ($parsed_file["PARAMETERS_LIST"][0]["PARAMETERS"] as $aparamlist) { if ($aparamlist['ID'] != $id) continue; if (!isset($aparamlist["PARAMETER"])) continue; foreach ($aparamlist["PARAMETER"] as $aparam) { $this->values[$aparam["NAME"]] = $aparam["value"]; } } } public function extract() { //Globalisons les valeurs foreach ($this->values as $value_name => $value_content) global ${$value_name}; //Affectons les extract($this->values, EXTR_OVERWRITE); } } ?>