|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
fdl Smarty n00b
Joined: 06 Aug 2004 Posts: 1
|
Posted: Fri Aug 06, 2004 12:31 pm Post subject: Template rendering error. |
|
|
Scenario goes like this:
1. Make a function
foo() {
$s = new Smarty;
$o = $s->fetch("bar.tpl");
$s->assign("c", $o);
die;
}
2. Make a template bar.tpl
....blah blah here comes some content....
{include file="some.tpl"}
3. make "some.tpl"
{plugin_caller} {*yes, this is whole content*}
4. make a "plugin_caller" plugin
in file "function.plugin_caller.php" :
function smarty_function_plugin_caller($params, &$smarty) {
foo();
}
5. create index.php that simply calls foo();
6. Now, how do you think, what happens? PHP sends everything that's beneath {include file="some.tpl"} to a brower: ....blah blah...
In short. foo() is called, it fetches "bar.tpl", bar.tpl includes "some.tpl" that calls foo() through a plugin, than foo() dies. No echo, no display and part of "bar.tpl" contents goes to your browser.
Do I do something wrong? There's no display method used, and no echo nor var_dump. _________________ --
Marcin Kowalski |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Aug 06, 2004 1:39 pm Post subject: |
|
|
fetch() uses output-buffering (http://php.net/outcontrol) to fetch the template's output. if your script dies (via die() or a fatal error) php flushes the output-buffer. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|