RE: [SMARTY-DEV] feature request

From: Date: Mon, 05 Jan 2004 16:28:52 +0000
Subject: RE: [SMARTY-DEV] feature request
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2024@lists.php.net to get a copy of this message
Thanks for your input! Using method calls on objects is an option yes, but I don't prefer this: I don't want the template designer to get access to my objects. I think smarty plugins are way much better for this approach. I give to the template designer a set of functions (smarty plugins) which he can use, together with a small manual what the input parameters and return values should be. Peter -----Original Message----- From: Mark Gibson [mailto:gibsonm@cromwell.co.uk] Sent: maandag 5 januari 2004 10:48 To: smarty-dev@lists.php.net Subject: Re: [SMARTY-DEV] feature request Peter Billen wrote: >>Besides this, I don't know if this is a good method of programming: a >>template may ask, for example, 'topic_name' and I detect that >>variable isn't set yet => I get it from the database. But after this, >>the template asks for 'topic_text' and I detect again that variable >>isn't set yet => I get it from the database. But now I have 2 queries >>(for 'topic_name' and 'topic_text') which could be combined into one >>query => overhead because in this situation 2 queries will take more >>time than 1 query. >> >> > >That's it... this isn't a good method of programming. The template mustn't >control what is assigned to itself, and accessing the database from within >the template on-demand is _really_ bad style. I'm sorry, but your proposal >doesn't comply with the idea of separation of presentation and application >logic ;-) > > David > > > Hi Peter, What you're describing is usually known as lazy evaluation, i wouldn't say it was bad programming style, the separation is still there, the only difference being the time of evaluation of the variables. To implement this in Smarty would probably require some work on the compiler, an alternative may be to use method calls on objects from within your templates: http://smarty.php.net/manual/en/advanced.features.php -- Mark Gibson <gibsonm@cromwell.co.uk> Web Developer & Database Admin Cromwell Tools Ltd. Leicester, England. -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.dev (#2024) next »