Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Template rendering error.

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
fdl
Smarty n00b


Joined: 06 Aug 2004
Posts: 1

PostPosted: Fri Aug 06, 2004 12:31 pm    Post subject: Template rendering error. Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Aug 06, 2004 1:39 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP