function CreateVars($value = '', $key = '', $path = '') {
$keypath = !empty($path) ? $path . "." . $key : $key;
if (is_array($value)) {
// added
// type name fields
$info_string = 'array'.',' . $keypath.',' . implode(',' , array_keys($value));
foreach ($value as $subkey => $subval) {
$this->CreateVars($subval, $subkey, $keypath);
}
// added
$this->CreateVars($info_string, '__info', $keypath);
}
else {
$this->phx->setPHxVariable($keypath, $value);
}
}
$aaaa = array( "field1" => 5, "field2" => array( "field21" => 2));
[+aaaa.__info+] = "array,aaaa,field1,field2" (added placeholder containing type, name, fields list) [+aaaa.field1+] = "5" (no news) [+aaaa.field2.__info+] = "array,aaaa.field2,field21" (added placeholder containing type, name, fields list) [+aaaa.field2.field21+] = "2" (no news)
[+phx:input=`[+aaaa+]`:elements=`[+aaaa.__info+]`+]
<?php
if ($options == '') return $output; // $output is a simple variable!!
$var_info = explode(',',$options);
$var_type = $var_info[0];
switch ($var_type) { // will add object type?
case 'array':
$var_name = $var_info[1];
$var_fields_array = array_slice($var_info, 2);
break;
default:
break;
}
$string .= '<h5>' . $var_name . ' = ' . $var_type . '</h5><br/>
';
$string .= '<ul>
';
foreach ($var_fields_array as $fieldname) {
$field_placeholder = '[+' . $var_name . '.' . $fieldname . '+]';
$options_placeholder = '[+' . $var_name . '.' . $fieldname . '.__info' . '+]';
$string .= '<li>' . $fieldname . ' = ' . '[+phx:input=`' . $field_placeholder . '`:elements=`' . $options_placeholder . '`+]' . '</li>
';
}
$string .= '</ul>
';
return $string;
?>
« MODx Parse Error » MODx encountered the following error while attempting to parse the requested resource: « PHP Parse Error » PHP error debug Error: include_once(/assets/plugins/phx/phx.parser.class.inc.php) [function.include-once]: failed to open stream: No such file or directory Error type/ Nr.: Warning - 2 File: /mnt/target03/358650/www.arezombiesattacking.com/web/content/manager/includes/document.parser.class.inc.php(745) : eval()'d code Line: 10 Parser timing MySQL: 0.0121 s (3 Requests) PHP: 0.1680 s Total: 0.1801 s

This discussion is closed to further replies. Keep calm and carry on.