Code Comments
Programming Forum and web based access to our favorite programming groups.On Sat, Nov 27, 2004 at 01:04:13AM -0600, Jim Tom Polk wrote: > After almost 2 hours, I admit defeat. > > How do you change the the form template without going into > HTML/QuickForm/Renderer/Default.php file and adjusting $_headerTemplate, > $_elementTemplate, $_formTemplate and $_requiredNoteTemplate? Have a look at: http://pear.php.net/manual/en/packa...basic-renderers <?php require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/Renderer/Default.php'; $form = new HTML_QuickForm(); $form->addElement('header', null, 'Sample Header'); $renderer = &new HTML_QuickForm_Renderer_Default(); $renderer->setHeaderTemplate('<h2>{header}</h2>'); $form->accept($renderer); echo $renderer->toHtml(); ?> <snip> Regards, Doug
Post Follow-up to this messageDoug, you saved me from defeat! I am able to make changes. Thank you. I gather from this then that there is no way to continue using.. $form->display(); ...by there being a method to change one of those four variables without using the QuickForm.php and Renderer/Default? I was hoping for something that would be like: $form-> setHeaderTemplate($headerTemplateVariabl e); $form->display; Where $headerTemplateVariable would be from a file that someone could adjust the headerTemplate code separate from editing Default.php, thus allowing for a simple one liner to make the change. I'm trying for the second time this year to write some extensions that would allow drag, drap and inspect usage of PEAR DB, QuickForm, Mail, Pager and Table. I have to figure a way to be able to have the same code display when someone accepts the default renderer and then when someone wants to alter the template. This does it, but I'm going to have to rewrite a few things, and that is a pain since the way I'm modifying the code is using JavaScript regex, plus it adds a lot of lines of code...and I'm trying to keep that to a minimum for starters. I personally just edit the Default.php file and simply pull the changes from a prior version and slap it in... Again, thanks. Doug Kearns wrote: > On Sat, Nov 27, 2004 at 01:04:13AM -0600, Jim Tom Polk wrote: > > > > Have a look at: > http://pear.php.net/manual/en/packa...basic-renderers > > <?php > require_once 'HTML/QuickForm.php'; > require_once 'HTML/QuickForm/Renderer/Default.php'; > > $form = new HTML_QuickForm(); > $form->addElement('header', null, 'Sample Header'); > > $renderer = &new HTML_QuickForm_Renderer_Default(); > $renderer->setHeaderTemplate('<h2>{header}</h2>'); > > $form->accept($renderer); > > echo $renderer->toHtml(); > ?> > > <snip> > > Regards, > Doug
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.