Re: [SMARTY-DEV] Bug in Smarty Compiler concerning constants?
| From: | Jan Rosier | Date: | Wed, 09 Mar 2005 08:52:00 +0000 |
| Subject: | Re: [SMARTY-DEV] Bug in Smarty Compiler concerning constants? | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2658@lists.php.net to get a copy of this message | ||
Just an idea. You could also change the test function you use in the { if } tags to detect that it got the constant as a string.
class Example
{
/**
* Example function
*
* @access public
*
* @param integer|string* * @return boolean */ function hasPerm($perm) {
if (is_string($perm)) {
$perm = constant($perm);
}
if (is_integer($perm)) {
if (($this->getUserPermissies() & $perm) == $perm) {
return TRUE;
}
}
return FALSE;
}
}
Greetings, Jan Rosier
* Space and time are relative. - Albert Einstein *
Oliver Jones wrote:
On Mon, 2005-03-07 at 23:04 -0800, boots wrote:It looks like there is an issue but I believe that Smarty should output quoted text rather than a constant token, not? Especially since constants are accessed from the $smarty reserved variable, ie: $smarty.const.CONSTANT.Erk. No. That would be annoying. Sure I can understand using $smarty.const.CONSTANT etc when using the {$var} syntax as without a prefix there would be no way of differentiating between function calls and constants but that is just plain annoying (and unnecessary) in {if } tags. Though understandable if you wanted a consistent API. Personally I'm not a huge fan of the whole $smarty.{section,const,capture} business. Regads --Oliver Jones » Roving Code Warrior oliver@deeperdesign.com » +64 (21) 41 2238 » www.deeperdesign.com