Re: Quickform Renderer
| From: | Bertrand Mansion | Date: | Fri, 04 Apr 2003 14:57:44 +0000 |
| Subject: | Re: Quickform Renderer | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-14892@lists.php.net to get a copy of this message | ||
<jeroen@terena.nl> wrote :
> Bertrand Mansion wrote:
>
>> <jeroen@terena.nl> wrote :
>>
>>
>>
>>> Hi,
>>>
>>> I was just wondering how the development on the Quickform Renderer is
>>> going and if I can test anything yet?
>>>
>>>
>>
>> There are already a few renderers available in CVS. At the moment, you will
>> need to checkout the cvs version if you want to test them. Let me know if
>> this is ok with you.
>>
>> The renderers available are the following:
>>
>> - Default :
>> This renderer uses the same kind of rendering as the one that was available
>> in previous QuickForm versions. This way, backward compatibility is ok.
>>
>> - Array :
>> This is actually the renderer that will output an array representation of
>> the QuickForm content. It is similar to the toArray() method and is actually
>> called when toArray() is called. The only difference with previous toArray()
>> method is that every element gets a numeric index in the array. Previous
>> version was a bit harder to parse.
>>
>> - ITX :
>> This renderer uses the HTML_Template_ITX package. It works by looping
>> through a 'qf_main_loop' using styles defined in other blocks. There is a
>> possibility to attach an element to a style block.
>>
>> I have also made an ITX renderer that is more low level than the looping one
>> but I am still testing it. It works differently: it uses placeholders for
>> each elements in the form. Then, when it finds a placeholder, it replaces it
>> by a parsed style block. It allows for very weird presentation, forms with
>> horizontal layout, forms alternating comments and widgets...
>>
>> I haven't committed it yet but I can send it to you along with an example if
>> you want. I am waiting for Alexey Borzov to give me his opinion as he is the
>> one who wrote the first ITX renderer.
>>
>> If you have some time to test it, let me know. I'll send to you a few
>> examples. I would be happy to know your opinion about both ITX
>> implementations.
>>
>> Bertrand Mansion
>> Mamasam
>>
>>
> Hi Betrtrand,
>
> Thanks for the quick reply. I already had a quick look at the code in
> CVS. I don't understand too much of the ITX renderer as I don't use
> IT/ITX. The only reason why I don't use a template system is because I
> haven't found a good way to make it work with quickform yet, which is
> why I'm so interested in the new Quickform. So yes I'll be happy to test
> anything you may have. Send it to me and I'll have a look at it next week..
I'll probably send it this weekend then.
> As for the array renderer, I had a quick look and noticed one thing:
> There is still HTML in the array. I don't really understand this as HTML
> should only be in the template file (if you ask me). Take a selectbox
> for instance. A designer might want to create a selectbox that looks
> like this:
QuickForm renders the element in the array to have it available for later
use. What would you expect instead ?
> <select class="weirdbox">
> <options>Make your selection</option>
> <option style="background-color: blue;">Amsterdam</option>
> <option style="background-color: green;">Paris</option>
> <option style="background-color: blue;">Berlin</option>
> <option style="background-color: green;">Whoopville</option>
> </select>
$select =& $form->addElement('select', 'myselect');
$select->addOption('Amsterdam', 'Amsterdam', array('style' =>
'background-color:blue;'));
$select->addOption('Paris', 'Paris', array('style' =>
'background-color:green;'));
And so on...
> A lot of this selectbox is purely design and should be in the template.
> I don't see how this can be done with the array renderer, because in the
> array there is never a list with values for the selectbox just the
> actual HTML.
>
> Can you elaborate on this? Thanks!
The rendered array is not meant to replace what you would do with QuickForm..
If you need to modify your elements, do it with the QuickForm object. Then,
when you are ready, and need an array representation, use toArray().
I am not sure I understand what you're talking about.
Bertrand Mansion
Mamasam