Re: [SMARTY] Math tokens undefined in 2.4.0 {if} blocks
| From: | Monte Ohrt | Date: | Mon, 03 Feb 2003 20:12:11 +0000 |
| Subject: | Re: [SMARTY] Math tokens undefined in 2.4.0 {if} blocks | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7492@lists.php.net to get a copy of this message | ||
They were never officially supported, and the new parser is much more
strict. I can add those in on the next CVS commit.
If you can't wait, look for the _compile_if_tag() function in
Smarty_Compiler.class.php and add them at the top of the switch
statement:
switch ($token) {
case '!':
case '%':
case '!==':
case '==':
case '>':
case '<':
case '!=':
case '<=':
case '>=':
case '&&':
case '||':
case '|':
case '^':
case '&':
case '~':
case ')':
case ',':
--> add here
case '+':
case '*':
case '/':
case '-':
Monte
On Mon, 2003-02-03 at 13:50, Duke Ionescu wrote:
> index.php:
> <?php
> require_once('Smarty.class.php');
> require_once('Config_File.class.php');
>
> $sm = new Smarty;
>
> $sm->assign('one', 1);
> $sm->assign('two', 1);
> $sm->assign('three', 1);
>
> $sm->display('index.tpl');
>
> ?>
>
> index.tpl:
> {if $one + $three > $two}yes{else}no{/if}
>
> Result:
> Fatal error: Smarty: [in index.tpl line 1]: syntax error: unidentified token
> '+' (Smarty_Compiler.class.php, line 1202) in
> /usr/local/lib/php/Smarty_Compiler.class.php on line 1818
>
> This used to work in 2.3.1 and it doesn't make sense for it to go away. All
> math tokens are gone.. why? No mention of this in the release notes.
--
Monte Ohrt <monte@ispi.net>