RE: [SMARTY-DEV] feature request
| From: | Peter Billen | Date: | Sun, 04 Jan 2004 17:44:04 +0000 |
| Subject: | RE: [SMARTY-DEV] feature request | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-2019@lists.php.net to get a copy of this message | ||
Oops I made some English errors (not my mother language), sorry, I fixed
some of them below.
Peter
-----Original Message-----
From: Peter Billen [mailto:peter@clueless.be]
Sent: zondag 4 januari 2004 18:42
To: smarty-dev@lists.php.net
Subject: [SMARTY-DEV] feature request
Hi all,
I have a feature request. I'll explain what I'm thinking off:
I want to give the template designers as much information as possible. But
assigning all the possible variables (with the assign() function) is
useless, because most of the time the template designer doesn't use all
the variables, so there may be unneeded database queries (for example) to
set all avaiable variables.
Therefore, it might be a good idea only to retrieve the information when the
user asks for it. This can be detected when the template asks for a variable
{$var} that isn't set yet.
So my request is: a function in class Smarty that will be called when the
template asks for a variable that isn't set yet (so I can override Smarty
and implement the function) OR a system similar as the plugins
(http://smarty.php.net/manual/en/plugins.php) so I can register my own
function as 'call when template asks for unknown variable'.
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.
An option might be to retrieve 'topic_text' also when the template asks for
'topic_name', and cache/store it in memory. But what about the situation
when 'topic_text' is NOT called in the template => overhead because I
retrieved too much information, so the query takes more time than needed.
Kind regards,
Peter
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php