Re[2]: [SMARTY] if operators suggestions
| From: | Bertrand DUNOGIER | Date: | Thu, 11 Apr 2002 18:47:54 +0000 |
| Subject: | Re[2]: [SMARTY] if operators suggestions | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3644@lists.php.net to get a copy of this message | ||
AZ> It's a nice idea, but how would you control such aspects as
AZ> case-sensitive or -insensitive matching?
It's a nice question :)
I think that basically, it should just be case sensitive...
Maybe a different operator for case insensitive operations ?
Earlier on i needed that operator so i wrote a basic one. Here is the
diff:
[katana@dante smarty-templates]# diff Smarty_Compiler.class.php Smarty_Compiler.class.new.php
918a919,928
> case 'found':
> if (@$tokens[$expr_end] == 'in') {
> $expr_end++;
> $expr_arg = $tokens[$expr_end++];
> $expr = "strstr($expr_arg, $is_arg)";
> } else {
> $this->_syntax_error("expecting 'in' after
> 'found'");
> }
> break;
>
It is used that way: {if 'somestring' is found in $somevar}
Of course, something based on pregs / eregs would be nice, too.