Re: [SMARTY] Bug report: Smarty.const._SOME_CONST still broken in IF statement?
| From: | messju mohr | Date: | Mon, 17 Feb 2003 13:47:38 +0000 |
| Subject: | Re: [SMARTY] Bug report: Smarty.const._SOME_CONST still broken in IF statement? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7796@lists.php.net to get a copy of this message | ||
On Sun, Feb 16, 2003 at 01:43:20PM -0600, Monte Ohrt wrote:
> fix committed to CVS
i encountered another minor flaw with constants:
you cannot access with variables containng the name:
{$smarty.const.$constname}
this throws a syntax-error in this line
<?php echo defined('".$this->_tpl_vars['constname']."') ?
$constname : null; ?>
the fix for that is simple:
diff -r1.171 Smarty_Compiler.class.php
1781c1781
< $compiled_ref = 'defined(\'' .
substr($indexes[0],1) . '\') ? ' . substr($indexes[0],1) . ' : null';
---
> $compiled_ref = 'defined("' .
> substr($indexes[0],1) . '") ? ' . substr($indexes[0],1) . ' : null';
regards
messju
> On Sat, 2003-02-15 at 10:08, Ruslan Savchyshyn wrote:
> > Hello
> >
> > Using smarty 2.4.1 (with const patched manually) or latest 2.4.2.
> >
> > {if $counter mod $smarty.const._CARS_PER_PAGE == 0}text{/if}
> > Doesn't work.
> >
> > {assign var=per_line value=$smarty.const._CARS_PER_PAGE}
> > {if $counter mod $per_line == 0}text{/if}
> > Works great, but is workaround.
> >
> > ------------------------
> > Ruslan aka SavaJr
> --
> Monte Ohrt <monte@ispi.net>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Uptime: Verfügbar an Werktagen zwischen 9:00 und 12:00, sowie 14:00 bis 17:00.
<A href="http://www.microsoft.com/mspress/books/sampchap/4519.asp#102">Microsoft
SQL Server 2000 Administrator's Companion</A>