Accessing minus parameter in templates

I stumbled over the problem, that I had to access some of the minus parameters (e.g. -action, -table) in templates, but this wasn't possible the normal way:
You can't access it, when the key-value of the array (because it's in fact $ENV['REQUEST']['-table']) doesn't meet the php variable naming conventions. So minus, space, dot ect. doesn't work.
All these scenarios of "bad keys" and tried solutions via escaping don't work.
There are two possible ways:
- Rewrite the array: Probably not so good for Xataface
- A workaround:
In fact it is a Smarty problem, but because of the naming convention of Xataface I thought posting this could help others who stumble over this problem too.
- Code: Select all
{if $ENV.REQUEST.-table == ...} -- doesn't work.
You can't access it, when the key-value of the array (because it's in fact $ENV['REQUEST']['-table']) doesn't meet the php variable naming conventions. So minus, space, dot ect. doesn't work.
- Code: Select all
{if $ENV.REQUEST.`with space` == ...}
{if $ENV.REQUEST."min-us" == ...}
{if $ENV.REQUEST.'with.dot' == ...}
All these scenarios of "bad keys" and tried solutions via escaping don't work.
There are two possible ways:
- Rewrite the array: Probably not so good for Xataface
- A workaround:
- Code: Select all
{assign var=_table value="-table"}
{if $ENV.REQUEST.$_table == ...)
In fact it is a Smarty problem, but because of the naming convention of Xataface I thought posting this could help others who stumble over this problem too.