[prev in list] [next in list] [prev in thread] [next in thread]
List: smarty-general
Subject: [smarty] smarty] Re: How does compiling work?
From: "Brian E. Lozier" <brian () massassi ! net>
Date: 2001-12-28 22:51:13
[Download RAW message or body]
Then what exactly does compiling do? It compiles the templates themselves together? \
But what happens if I have a conditional template call?
if($condition) {
$tpl->assign('Content', $tpl->fetch('condition1.tpl'));
} else {
$tpl->assign('Content', $tpl->fetch('condition2.tpl'));
}
How does smarty compile that? If it leaves the templates totally separate (which \
seems like the only way possible..) why is it called compiling? What gets compiled?
----- Original Message -----
From: Andrei Zmievski <andrei@ispi.net>
To: smarty@lists.ispi.net
Date: 12/28/01 2:16:10 PM
>
> On Fri, 28 Dec 2001, Brian E. Lozier wrote:
> > How can a compiled system such as this work? Is it doing all my database calls \
> > twice? Is it rebuilding
the
> > compiled template on each invocation of the script?
> >
> > If I've got an index.php which contains something like:
> >
> > $tpl = new Smarty;
> >
> > $dbInfo = mysql_fetch_row();
> > $tpl->assign('DBInfo', $dbInfo);
> >
> > $tpl->display('main.tpl');
> >
> > It doesn't seem like it has a chance to just use the compiled template BEFORE \
> > executing all the logic in
the
> > main script. So the question is, is it doing all the db calls first, then seeing \
> > the compiled 'main.tpl', deciding it doesn't need recompiling, then it's \
> > re-doing all the db calls in the compiled version,
ignoring
> > everything that happened previously?
>
> Compiled templates don't have any DB calls. Your main scripts has them.
>
> -Andrei
>
> "In My Egotistical Opinion, most people's C programs should be indented
> six feet downward and covered with dirt." -- Blair P. Houghton
>
> ---
> You are currently subscribed to smarty as: brian@massassi.net
> To unsubscribe send a blank email to leave-smarty-700385W@lists.ispi.net
> Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/
---
You are currently subscribed to smarty as: smarty@progressive-comp.com
To unsubscribe send a blank email to leave-smarty-700385W@lists.ispi.net
Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic