From: Ed Greenberg on
Hi Folks,

I'm using HTML_QuickForm with Smarty as the renderer.

I recently got an HTML page to be converted to a smarty template, in
which each of the form tags had a class parameter, such as:

<input class="dsR37" type="text" name="firstname" value="" size="18"
tabindex="1" />

I'd like to replace that input tag with:
{$form.firstname.html}
but I do not want to take responsibility for the class, the size or the
tabindex. These need to remain with the designer. She already has an
error in her tabindexes, and I'd like her to be able to fix it.

Is there any good thing I can do to leave responsibility for those
things with the designer, other than just leave the input tag alone. For
instance, can the designer somehow leave something in the template that
_I_ can read and then feed back into Quickform?

Thanks,
</edg>
Ed Greenberg
From: "Hollenbeck, Dan" on
Hi,

I would create the following Smarty plugin modifier functions:

//Insert or modify the class name on a html input string
//Save this function in filename modifier.classname.php
function smarty_modifier_classname($string)
{
//insert the code here to set the class name
//return modified string with new class name
}

//Insert or modify the tabindex on a html input string
//Save this function in filename modifier.tabindex.php
function smarty_modifier_tabindex($string)
{
//insert the code here to set the tab index
//return modified string with new tabindex
}

In the smarty template the usage would be:

{$form.firstname.html|classname:'myClassName'|tabindex:'4'}

Thanks, Dan

Daniel Hollenbeck
512-732-8400 ext 238
dan.h(a)thoughtfulhouse.org


-----Original Message-----
From: Ed Greenberg [mailto:edg(a)greenberg.org]
Sent: Friday, May 02, 2008 1:32 AM
To: pear-general(a)lists.php.net
Subject: [PEAR] HTML_QuickForm/Smarty Best Practice

Hi Folks,

I'm using HTML_QuickForm with Smarty as the renderer.

I recently got an HTML page to be converted to a smarty template, in
which each of the form tags had a class parameter, such as:

<input class="dsR37" type="text" name="firstname" value="" size="18"

tabindex="1" />

I'd like to replace that input tag with:
{$form.firstname.html}
but I do not want to take responsibility for the class, the size or the
tabindex. These need to remain with the designer. She already has an
error in her tabindexes, and I'd like her to be able to fix it.

Is there any good thing I can do to leave responsibility for those
things with the designer, other than just leave the input tag alone. For
instance, can the designer somehow leave something in the template that
_I_ can read and then feed back into Quickform?

Thanks,
</edg>
Ed Greenberg

--
PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php