Re: Re: Quickform: requiredtemplate issues

From: Date: Wed, 18 Jun 2003 14:28:06 +0000
Subject: Re: Re: Quickform: requiredtemplate issues
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17552@lists.php.net to get a copy of this message
Thomas Schulz wrote:
Jeroen Houben wrote in php.pear.dev:
I think it would be nicer if you could just pass a filename to $renderer->setRequiredTemplate because that's also how Smarty works. With template files, not string data. Not a huge problem though because I can just do file_get_contents().
Yes, you are right. The current behavior is used to have a Syntax similar to ITStatic Renderer and because the template pieces are so small. Maybe we should have some kind of automagic detection: if there is an template-file named like the given string take this, else eval the string as template code... Comments? Well I would still go for files. Sure it's a small piece of data, but so are some of the templates. A great advantage of using templates is that (apart from the really braindead) designers can completely modify the visual appearance of a website. I can just give a designer access to the directory where the templates reside and that's it. I don't want him or her digging around in PHP code to change the error templates for instance. That was why we seperated logic and presentation in the first place.
Checking to see if it's a string or a file seems a bit ugly IMO.
Another issue is not so easy to solve. I like to leave form labels out of my PHP code, because I think form labels belong to the template. Moreover, my PHP code drives several sites which all look different because I'm using different Smarty templates. I would also like to have different form labes for different sites.
Personally I define the labels only as placeholder and misuse my i18n modifier to get different labels for different sites and languages: {$label|translate} If the current user has the permission to "translate" the site, this modifier produce also some popup-code for in-site-translation... :-) yeah that sounds pretty cool, I might look into that. So "translate" is something you wrote for Smarty, like a custom modifier?
I guess I'm a bit of a purist when it comes to these things. I actually believe things like "size", "cols", "rows" etc should also be defined in the template, along with the element label. Instead having it as PHP code. But I can see why it can be useful to generate these HTML properties at runtime on the server. Jeroen

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