New and funny development
| From: | Michael Stolovitzsky | Date: | Fri, 31 May 2002 17:03:20 +0000 |
| Subject: | New and funny development | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-4486@lists.php.net to get a copy of this message | ||
Now that with your help I beat Smarty (actually it's me who didn't read the
manuals, I will be more careful about it from now on), there's a new
interesting development: for some funny reason Smarty calls my block plugin
function in reverse order. That means closing tag is processed before the
opening tag. As a result the HTML output is something like </a><a>$content
No, it's not the plugin function that's broken, as the function isn't stateful
and doesn't care about the order of calls.
Anyone has ideas about why it might be happening? I'm completely dazzled about
whatever might be causing it, cause it's really weird ;)
Smarty version is 2.2.1, unmodified, extracted directly from the tarball.
Here:
--- plugins/block.link.php
function smarty_block_link($params, $content, &$smarty)
{
if ($content) {
extract ($params);
echo "<a href=\"?context=$context&command=$command\">$content";
}
else return '</a>';
}
--- templates/example.tpl
<HTML>
<BODY>
{link context=foo}WTF?{/link}
</BODY>
</HTML>
--- ./test.php
<?php
require "Smarty.class.php";
$S = new Smarty;
$S -> display('example.tpl');
?>
--- Browser output:
<HTML>
<BODY>
</a><a href="?context=foo&command=">WTF?
</BODY>
</HTML>