|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
dleffler Smarty Rookie
Joined: 20 Sep 2011 Posts: 8
|
Posted: Thu May 10, 2012 3:35 pm Post subject: Smarty 3 should be more php compliant |
|
|
In php 'notice' warnings are displayed for things like referencing an uninitialized array/object, etc... In turn, the smarty compiler outputs some unclean code. e.g.,
Code: | {if $permissions.create == 1 && empty($hidebox)} | outputs Code: | <?php if ($_smarty_tpl->tpl_vars['permissions']->value['create']==1&&$_smarty_tpl->tpl_vars['hidebox']->value==0){?>
| which generates these warnings
Code: | Notice: Undefined offset: -1 in C:\UwAmp\www\exp2\tmp\views_c\f6e525a8e0cb94aa52198089c47123dd^685127c111bb65f53550deca737d502e65d76e5a.file.YUI Top Nav.tpl.php on line 61 |
Code: | Notice: Trying to get property of non-object in C:\UwAmp\www\exp2\tmp\views_c\f6e525a8e0cb94aa52198089c47123dd^685127c111bb65f53550deca737d502e65d76e5a.file.YUI Top Nav.tpl.php on line 61 | 'empty' should be compiled to the empty php function, right? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu May 10, 2012 7:32 pm Post subject: |
|
|
It does correctly compile to
<?php if ($_smarty_tpl->tpl_vars['permissions']->value['create']==1&&empty($_smarty_tpl->tpl_vars['hidebox']->value)){?>
Which version of Smarty did you use? |
|
Back to top |
|
|
|
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
|