For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > February 2005 > little tipps for Smarty using PEAR Quickform









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author little tipps for Smarty using PEAR Quickform
Patrick Fehr

2005-02-25, 4:02 pm

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com