problem with simple {if} syntax

From: Date: Tue, 14 May 2002 13:17:42 +0000
Subject: problem with simple {if} syntax
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4186@lists.php.net to get a copy of this message
Hi all, I've been having a problem with {elsif} in my installation. This problem occurs with both Smarty 2.01 and 2.11. The rest of the setup is Apache 1.3, PHP 4.1.2 running on FreeBSD 4.5. I've boiled this problem down to a simple php file and template: -- test.php -- <?php require("Smarty.class.php"); $smarty = new Smarty; // render the page with a this template $smarty->assign("Test", "foo"); $smarty->display("test.tpl"); ?> -- EOF -- -- test.tpl -- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test Page</title> </head> <body> {if $Test eq "foo"} <p>It is foo</p> {elsif $Test eq "bar"} <p>It is bar</p> {else} <p>It isn't foo or bar</p> {/if} </body> </html> -- EOF -- Every time I load this page I get the following error: Fatal error: Smarty: [in test.tpl line 11]: syntax error: invalid attribute name - '$Test' in /usr/local/lib/php/Smarty_Compiler.class.php on line 1316 You'll note the line number is the {elif} not the if. If I eliminate the {elsif} clause everything works fine. It also doesn't matter what variable I use in the {elsif} test clause. It fails all of them. Does anyone have any ideas? Thanks, Mark

« previous php.smarty.general (#4186) next »