Re: Quickform and templates

From: Date: Tue, 25 Feb 2003 13:01:54 +0000
Subject: Re: Quickform and templates
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-13849@lists.php.net to get a copy of this message
<borz_off@cs.msu.su> wrote : > 24 Февраль 2003 18:20, Bertrand Mansion написал: >> Yep, I will but I am waiting to have the last version of IT in PEAR... And >> it looks like this is taking more time than I thought it would ;) >> >> ... >> >> In terms of timing, I won't be able to code it this week as I have a job to >> finish. I'll probably start next weekend. I hope it will rain ;) > > I can try to make some prototype implementation of IT-based form renderer... > But as I am becoming more careful in proposing my work, I'd like to ask first: > should I bother? ;] Please bother :) I appreciated the work you have done with IT and I feel confident you can come up with a good implementation. Let's consider it as a collaborative work. You send me your implementation, I review it, modify it if needed, add some features you might have overlooked, then send it back to you and when we all feel ok about it, we will commit it. I like the idea of a bridge. I would call it HTML_QuickForm_Layout or HTML_QuickForm_Render. I also like the idea of renderers like HTML_QuickForm_Render_IT, HTML_QuickForm_Render_Smarty... I have never used Flexy or Xipe. Alan, do you think this architecture could work with Flexy ? When we will have something up and running with IT, do you feel like implementing something for Flexy ? Having a default layout block is also important if there is no per element block available in the template. Blocks for groups should maybe incorporate sub-blocks for elements contained in the group. There might also be a default block for elements in a group block. Here is a possible implementation for the initialization, but there are probably some other ways... 1. Instantiate a template object: $tpl = new HTML_Template_IT('.'); $tpl->setTemplate...('mytpl.tpl'); 2. Pass it to the HTML_QuickForm_Render constructor: $rend = new HTML_QuickForm_Render($tpl); 3. Inside the renderer, check the type of template object and choose the right class for the render methods. It might also be interesting to limit the rendering to just a few elements. This could be useful if we implement some kind of matrix rendering for example for grids. We could then have a part of the form rendered as a grid with x columns and y rows and the other part rendered using a template. It should also be possible to set a block for an element on runtime as I do at the moment with setElementTemplate(). Actually, it would be even better if we could set a block for more than just one element. The form template will probably need some special placeholders like {QF_JAVASCRIPT} {QF_START} {QF_END}. It shouldn't be compulsory to have error blocks inside element blocks. This way, we could have all errors reported on top of the form or anywhere else. We will probably need to change the way we deal with templates for required elements in QuickForm. We will need to add a default rendering for required elements. That's just some ideas... Feel free to comment. Thanks for jumping in. Bertrand Mansion Mamasam

« previous php.pear.dev (#13849) next »