DS.'com_users'.
DS.'users.xml';
// parse the XML
$parser->loadFile($pathToXML_File);
In order to add new param tags to the XML, we need to navigate to the params tag:
// get the root tag (install)
$document =& $parser->document;
// get the params tag
$params =& $document->params[0];
We can now start adding to the XML using the addChild() method to add child
param tags, and the addAttribute() method to set the necessary param tag
attributes. This example adds the parameters myparameter and myotherparameter,
both of which we defined in the previous example:
// Add myparameter
$myparameter =& $params->addChild('param');
// modify the myparameter attributes
$myparameter->addAttribute('name', 'myparameter');
$myparameter->addAttribute('type', 'text');
$myparameter->addAttribute('label', 'My Parameter');
$myparameter->addAttribute('description', 'An example user
parameter');
// Add myotherparameter
$myotherparameter =& $params->addChild('param');
// modify the myotherparameter attributes
$myotherparameter->addAttribute('name', 'myotherparameter');
$myotherparameter->addAttribute('type', 'text');
$myotherparameter->addAttribute('label', 'My Other Parameter');
$myotherparameter->addAttribute('description', 'An example user
parameter');
Chapter 7
[ 183 ]
Now that we have made the changes to the XML file, we need to save those changes
to the users.
Pages:
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257