Re: [phplib] templates & oohforms From: Kirk Ismay (captain <email protected>)
Date: 07/20/00

> "Brownridge, Tom" wrote:
>
> 1) Theorize for a moment that in addition to the show_element() method
> of the form class, there was a matching element() method that returned
> a string.
>
> 2) Then, let there be objects $t and $f, a template and a form object,
> respectively.
>
> 3) Assuming a template variable and a form element had identical names
> (stored in $name), It would follow that I could write the code:
>
> $t->set_var($name, $f->element( $name ) );
>
> 4) By extending template, I could further simplify things to produce
> code like:
> $t->set_form_var($name, $f);
>
> 5) This appears to suit my lazy lifestyle by creating less code for me
>
> 6) We keep out PHP out of our templates, and our HTML out of our PHP
> scripts.
>
> Q) Is this a "BAD THING"? I'm afriad I've overlooked something, or
> someone would have done this already.
>
> Virtually,
> Tom Brownridge
> Assistant Professor of Computer Science
> Indiana Institute of Technology
> mailto:brownridge <email protected>
> voice phone: (219) 422-5561 x2257

Skip the theory, such a function exists!

There is a get_element() method in the oohforms class that can be passed
in to the template parser. Unlike show_element(), get_element() returns
the form tag,
which you can then assign to a variable or pass in to another function
etc.

In the documentation of oohforms, they use the show_element() method
that prints the form tags right away. They also neglect to mention the
existance of the get_element() method, at least in the copy of the docs
that I have.

I looked at the source of ooh_forms and found the get_element
function exists. In fact, show_element is merely
"print get_element( ... );"

Hope this points you toward the solution :)

-- 
Sincerely, Kirk Ismay
________________________________________________________________________
The Net Idea Telecommunications Inc            Support: tech <email protected>
101-625 Front Street,                          Sales:  sales <email protected>
Nelson BC, V1L 4B6
Phone: 352-3512 Fax: 352-9780            Open Monday to Friday 9:30-5:30
Toll Free: 1-888-246-4222                   10:00 - 4:00 on Saturdays
________________________________________________________________________

-- Sincerely, Kirk Ismay ________________________________________________________________________ The Net Idea Telecommunications Inc Support: tech <email protected> 101-625 Front Street, Sales: sales <email protected> Nelson BC, V1L 4B6 Phone: 352-3512 Fax: 352-9780 Open Monday to Friday 9:30-5:30 Toll Free: 1-888-246-4222 10:00 - 4:00 on Saturdays ________________________________________________________________________

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>