Re: Quickform: requiredtemplate issues
| From: | Thomas Schulz | Date: | Wed, 18 Jun 2003 14:12:09 +0000 |
| Subject: | Re: Quickform: requiredtemplate issues | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-17551@lists.php.net to get a copy of this message | ||
Jeroen Houben wrote in php.pear.dev:
> I think it would be nicer if you could just pass a filename to
> $renderer->setRequiredTemplate because that's also how Smarty works.
> With template files, not string data. Not a huge problem though because
> I can just do file_get_contents().
Yes, you are right. The current behavior is used to have a Syntax similar
to ITStatic Renderer and because the template pieces are so small. Maybe we
should have some kind of automagic detection: if there is an template-file
named like the given string take this, else eval the string as template
code... Comments?
> Another issue is not so easy to solve. I like to leave form labels out
> of my PHP code, because I think form labels belong to the template.
> Moreover, my PHP code drives several sites which all look different
> because I'm using different Smarty templates. I would also like to have
> different form labes for different sites.
Personally I define the labels only as placeholder and misuse my i18n
modifier to get different labels for different sites and languages:
{$label|translate}
If the current user has the permission to "translate" the site, this
modifier produce also some popup-code for in-site-translation... :-)
> Problem is,
> $renderer->setRequiredTemplate doesn't work if you don't use label in
> the PHP code (AFAIK).
You got it...
{$html}
{if $required}
<span class="form_required">*</span>
{/if}
Thomas.
--
http://4bconsult.de