Re: Smarty QuickForm2 Renderer

From: Date: Thu, 19 Nov 2009 13:51:36 +0000
Subject: Re: Smarty QuickForm2 Renderer
References: 1 2 3 4 5 6 7 8 9  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30155@lists.php.net to get a copy of this message
Hi Alain, Alain Williams wrote:
Try again - this time with a proper Subject and with the renderer attached.
You are using the smarty-dev list that is defunct for quite a bit of time: http://news.php.net/php.smarty.dev/3071
On Fri, Nov 13, 2009 at 04:09:33PM +0000, Alain Williams wrote:
I am writing an renderer for Smarty - I have taken the array renderer and am modifying/butchering/... it. I am aiming to product an array (which is what Smarty wants) that is compatible with current Smarty templates -- ie you are going to need to change the PHP, but hopefully will not have to change the templates.
Please find attached some new files that implement the above: a Smarty renderer for QuickForm2 * Renderer.php Modified to know about the smarty renderer. Accept a new option 'old_compat' - this causes the smarty renderer to do somethings that might not be wanted if you were starting from new. The point is that it allows existing smarty templates to be used without change.
You could add this option in your Renderer's constructor, no need to patch the base class.
* Smarty.php This implements a renderer. It works - at least in the way that I use QuickForm. There are some things not implemented, I prob did not understand how to do it with QuickForm. There are some comments saying what the returned array contains.
I had a brief look at your implementation: 1) Why aren't you extending the Array renderer? 2/3 of your class is copy-pasted from there. 2) Why do you have some hardcoded HTML inside the renderer? I can't really comment on its behaviour, since I'm not using Smarty and don't have code to run, so you'll have to wait for someone who does. I'd suggest trying the Smarty mailing lists once again, active ones this time. ;]
This was developed under PHP 5.3 on Linux. To see how this plugs together see a tutorial set that I have at: http://www.phcomp.co.uk/TechTutorial/QfSmarty/index.php (This runs the QuickForm and NOT the QuickForm2 version, but the output is the same). All feedback gratefully accepted. This is cross posted to both the PEAR-GENERAL and the SMARTY-DEV mail lists since it is relevant to both. Have fun!


« previous php.pear.general (#30155) next »