I found a BUG in Smarty!
| From: | Johann | Date: | Thu, 16 May 2002 09:43:34 +0000 |
| Subject: | I found a BUG in Smarty! | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-84@lists.php.net to get a copy of this message | ||
The following simple example shows bugs I found in Smarty.
start.php:
----------
<?php
require_once SMARTY_DIR."Smarty.class.php";
$itsSmarty = new Smarty;
$itsSmarty->caching = false;
$itsSmarty->display("main.tpl");
?>
main.tpl:
--------
{incude file="test.tpl" myvar="A"}
{incude file="test.tpl" myvar="B"}
{incude file="test.tpl" myvar="C"}
test.tpl:
---------
{include_php file="test.php"}
{php}
print "INSIDE2: ";
print_r($this->_tpl_vars['myvar']);
print "<br />";
{/php}
INSIDE1: {$myvar}<br />
test.php:
--------
<?php
print "INSIDE3: ";
print_r($this->_tpl_vars['myvar']);
print "<br />";
?>
RESULTS:
-------
INSIDE3: A
INSIDE2: A
INSIDE1: A
INSIDE2: B
INSIDE1: B
INSIDE2: C
INSIDE1: C
PROBLEM:
-------
There is no result from INSIDE3... :-( Values of myvar variable are
lost! Only first value is correct. Where are the others? It seems to
be a bug in Smarty templates implementation. :-(
--
Johann