Missing feature / feature request

0 views
Skip to first unread message

Ibmurai

unread,
May 27, 2009, 1:45:18 AM5/27/09
to php-outline
I love the lazy array resolution feature:
{@array.item.subitem}

But I'd really like to be able to use it generally, as in:
{if @user.id == 42}

Or:
{foreach $array as $index = $value}
{if @value.id == 42}
something
{/if}
{/foreach}

I've only tested the first one... The last one might actually work as
is...?

mindplay.dk

unread,
May 27, 2009, 7:29:44 PM5/27/09
to php-outline
The thing is, it collides with the error-suppression operator - which
is why I always had second thoughts about this feature...

So, two options:

1. Come up with a different syntax for lazy array resolution,

or

2. Ignore the collision, and accept that the error suppression
operator will not be available in templates.

Maybe you don't really need the error suppression operator in the
first place? The error level is already lowered, so that warning/
notice/strict messages are silenced.

What do you think?


On May 27, 1:45 am, Ibmurai <ibber_of_cre...@hotmail.com> wrote:
> I love the lazy array resolution feature:
> {...@array.item.subitem}

Ibmurai

unread,
May 28, 2009, 12:50:12 AM5/28/09
to php-outline
As you say, maybe just not support the suppression operator in
templates. As far as I can tell it can only be used to suppress
criticals, which is a VERY bad idea, imo (the script will die
silently).

Or maybe @ wasn't the best choice to begin with, because of this.
There's lots of other symbols, so why not change it? You could even
continue support of @, as it is now, if you wanted to.
I think % is the classic array identifier, but that's modulo in php...
How about a double symbol? $@, for example. As far as I can tell, that
combination would never be allowed in php... Or even better: $% ?

Rasmus Schultz

unread,
May 28, 2009, 9:11:16 PM5/28/09
to php-outline
I like your first point - I don't know who would use error suppression in a template, really.

I'll try to think of a clever way to implement this...
Reply all
Reply to author
Forward
0 new messages