RE: How to do a "smart form" functionality?
| From: | Andreas Aderhold | Date: | Tue, 17 Jul 2001 10:50:29 +0000 |
| Subject: | RE: How to do a "smart form" functionality? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1174@lists.php.net to get a copy of this message | ||
Hi Jimmy,
> I have had a look at Lemos' class. It is very comprehensive but also
> tedious to use.
> Most importantly it defines the HTML in the php code instead of inside
> the template where HTML belongs.
Not quite. Of course it belongs in the template. And some form HTML is
actually generated in the php, abstracted of course, but it is in php. But
you can define a output function and then pass the form output to smarty. I
did not have a closer look to the class but I guess you can use pass the
internal arrays of the form class to smarty an assemble the form this way.
Of course, it's not a very clean soultion, but the form class seems to be
very nice.
> I think there'd be no choice but to write one to work with smarty's way.
Hmm
> I am thinking of adding these tags:
> {form name=abc}
> {form_label name=name label="Name:"} {form_input name=name}<br>
> {form_label name=email label="E-Mail:" {form_input name=email}<br>
> {form_submit}
> {/form}
> any thoughts?
Of course you can do that. But by doing this you abstract html in php! I
thought you want to avoid this? To me the above is just another hard to read
form of
<form name=abc>
Name: <input type="text" name="name" value=""><br>
...
Also you still have to handle clientside verificaiton and the serverside
formvalidation by hand. Integrating all this will end up in many really
wired {form blah} tags.
Keep it simple. Manuels class is not perfect but I think with some thinking
you can use it with smarty. I'll snap to it as soon as I have time.
Andi