AW: Replacing include with include_once in Smarty::fetch()?
"Matthias Pigulla" <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <00A2E2156BEE8446A81C8881AE117F19110ABF@companyweb> |
Hello everyone, > -----Ursprüngliche Nachricht----- > Von: boots [mailto:[email protected]] > Gesendet: Donnerstag, 16. September 2004 03:10 > This is an interesting idea...but are you using a PHP > accelerator? That should speed-up includes considerably. > Further, the scenario you describe sounds hardly typical and > even if you are generating many emails in bulk (hmmmmmmmmmm) > I would assume that you wouldn't be facing many concurrent > users but rather simply having to sporadically endure a > longer running process. No, I'm not running an accelerator. As long as my problems are home-made, I'll try to solve them by better coding and better architecture - I can always use "external" tools later on ;). Besides that, maybe an accelerator can speed up the include - but does it scale up? Maybe I don't see the point, but (as long as the template does not need to be recompiled) my approach just takes one include, regardless of the number of iterations. The same aspects apply to memory usage. > In other words, optimizing here seems > unwarranted. Yes, I know, and I did not see any real benefits for "normal" users before. However, I wanted to share the idea with you and was amazed that you seem to have use for it: > cool compiler plugin that you can find in this thread > http://www.phpinsider.com/smarty-forum/viewtopic.php?t=291 > (which is on recursion, but you need not use it recursively). The concept is exactly the same, if you set it up right it should be possible just to {include file="the_template_itself"}. That could turn into a include_once and real PHP level recursion. messju used a compiler function for injecting the "function" strings, I used a postfilter as I want the function to span the whole template. I have hacked into Smart::fetch() what messju did as "smarty_compiler_fun". As messju already pointed out, his plugin may become a maintenance problem; maybe moving it into the Smarty class itself might help a little. The only thing one would have to think about a little is correctly setting up all variable scopes... > I don't mean to be impolite, but I sure hope this isn't some > spam related thing ;) No, I spend so much time fighting spam I'd never write such software ;) - Honestly, it's a (opt-in :) newsletter mailing system. Matthias -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php