little tipps for Smarty using PEAR Quickform
| From: | Patrick Fehr | Date: | Fri, 25 Feb 2005 14:39:41 +0000 |
| Subject: | little tipps for Smarty using PEAR Quickform | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-12263@lists.php.net to get a copy of this message | ||
Hi there
after long hours of $#*&% and the same, I think, I should share my thoughts:
Let's say your QuickForm is a guestbook where not every field is required
and you use the Renderer_Array_Smarty for the data.
The main problem with output afterwards is, that these fields are
then .label or .html
Eg: optional username.html and in unfrozen stage that is the input field
and in frozen stage it's NOT just the string of input, no it's a hidden
inputfield.
So for display if or if not, make the following:
{if ($form_data.username.html|trim|truncate:6:"" != " ")}
{$form_data.username.html}
{else}
no username given
{/if}
you can't just do {if ($form_data.username.html)} because the html is
generated ALWAYS, even if the user doesn't fill in anything.
So much for that
cu guys
hope this helps 1 in a million :)
--
Patrick Fehr
Swiss Federal Institute Of Technology