Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: [PEAR] Modify Default QuickForm Template
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

Report this thread to moderator Post Follow-up to this message
Old Post
Doug Kearns
11-27-04 01:55 PM


Re: [PEAR] Modify Default QuickForm Template
Doug, 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

Report this thread to moderator Post Follow-up to this message
Old Post
Jim Tom Polk
11-28-04 02:03 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Pear archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:57 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.