Is it possible to read node values from a dynamic element in a xml file using variables?
XML file:
<plugin_permission>
<plugin1>true</plugin1>
<plugin2>false</plugin2>
<plugin3>true</plugin3>
...
</plugin_permission>
PHP file:
$xml = simplexml_load_file('settings/groep/permissions/'.$groep.'.xml');
$pluginIdName = $pluginObj->getIdName();
return $xml->plugin_permission->$pluginIdName;
The output should be "true" or "false", but get literally nothing.
Problem solved
I solved my problem using xpath
$xml = simplexml_load_file('settings/groep/permissions/'.$groep.'.xml');
return $xml->xpath('/plugin_permission/'.$plugin->getIdName());