syntax error: expecting '=' after attribute name
| From: | Mark Rogers | Date: | Tue, 09 Dec 2003 17:13:53 +0000 |
| Subject: | syntax error: expecting '=' after attribute name | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1952@lists.php.net to get a copy of this message | ||
It is not currently possible to create a Smarty function as follows:
{testfunc option}
There are situations where it would be useful to allow single word
parameters/options (eg "hidden"), which currently require instead
{testfunc option=value}
How trivial is it to change this so that if the =value is missing a value of
TRUE is passed to the handler for that parameter, instead of generating an
error? Ie, so that the following are equivalent:
{testfunc option}
{testfunc option=TRUE}
It ought to be simple enough, but I just had a look at the tokeniser in
Smarty_Compiler::_parse_attrs and got a bit lost :-(
The specific use I had for this is a bit obscure, in that I'm trying to
create a comment function which I can use to tempoarily skip certain parts
of templates, eg:
{include file="mytemplate.tpl"}
becomes:
{xx include file="mytemplate.tpl"}
.. where xx simply does nothing; of-course this won't work because include
then needs a value after it.
But also consider situations where
{checkbox name="test" value="testval" checked}
is more readable than
{checkbox name="test" value="testval" checked=1}
--
Mark Rogers,
More Solutions Ltd