Use JParameter to manually write a form field item


/ Published in: PHP
Save to your folder(s)

For instance when you want to leverage the JElements in a admin view form...


Copy this code and paste it in your HTML
  1. $param = new JParameter('audioPath=/media/user/test.mp3');
  2. $xml = & JFactory::getXMLParser('Simple');
  3. $node = new JSimpleXMLElement( 'root', array());
  4. $node->addChild( 'param', array(
  5. 'type' => 'filelist',
  6. 'label'=>'Audio',
  7. 'name' => 'audioPath',
  8. 'default' => '',
  9. 'directory' => '/media/user/42daycourse',
  10. 'hide_default' => false,
  11. 'exclude' =>'(pdf|flv)'
  12. ));
  13. $param->setXml( $node );
  14. echo $param->render('formitemNamePrefix');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.