Re: [SMARTY] Forms processing with Smarty
Davi Leal wrote:
> Hi all,
>
> I have developed a custom template 'engine' to our website. Now, I want to
> migrate to the Smarty engine. I have read some documentation at your
> website, however I do not yet know how could I deal with forms processing
> with smarty. Below you can see an example.
>
> Using my custom template, I have to phases:
>
> First: Process all forms
>
> Second & Last: Displaying the output result
>
>
> Could you point me in the right way to convert the below example to Smarty?.
> Any advice?. Maybe an URI to read?.
>
> Regards,
> Davi
>
>
> --
> require_once "WebPage.php";
>
> require_once "Person_form.php";
> $personForm = new PersonForm();
>
> $webPage = new WebPage($personForm);
the WebPage class seems to be a good candidate for making
it a Smarty subclass.
> $webPage->processPage();
> $webPage->printPage();
if you made WebPage a subclass of Smarty you would
probably need to rewrite the printPage() method
to assign data to Smarty and output a template and add a
std interface (if your using php5 you could really use an interface here!)
to any object that might be passed into
the WebPage constructor so that you can have the passed
object assign any custom data it needs to 'the template'
(i.e. to the Smarty object) and tell the WebPage object which [content]
template needs to displayed.
make sense?
>
|