Re: [SMARTY-DEV] syntax error: expecting '=' after attribute name

From: Date: Wed, 10 Dec 2003 00:47:35 +0000
Subject: Re: [SMARTY-DEV] syntax error: expecting '=' after attribute name
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1954@lists.php.net to get a copy of this message
Hi all. --- Monte Ohrt <monte@ispi.net> wrote: > Straying from the template syntax rules only opens potential problems > for the future. That, and its certainly more difficult to tokenize. Word. Of course, I think Mark already realized that... --- Mark Rogers wrote: > > How trivial is it to change this > > [snip....] > > 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 :-( Besides, the impetous for this was: > > trying to create a comment function which I can use to tempoarily > > skip certain parts > > {xx include file="mytemplate.tpl"} > > .. where xx simply does nothing; of-course this won't work because First, under this scheme, "include" should now be an attribute of xx, but that is NOT what is suggested here. So it looks like a somewhat shady feature is proposed only so that it can then be used to hack another feature -- ugh. FWIW, the correct way to comment in Smarty is of course to use the built-in comment construct {* ... *}. On the other hand, you may object because you cannot nest comments. Do the same thing you'd have to do in PHP to get around that: {if 0} {include ....} {/if} As a bonus, code need only be searched for occurences of the otherwise unused {if 0} to find the locations of those "temporary" patches. Alternatively, a new custom block function can easily be rolled for this; in that case, bail-out on the first entry to the block (ie: $repeat=false) so that the block content is never returned to the template. > > But also consider situations where > > {checkbox name="test" value="testval" checked} > > is more readable than > > {checkbox name="test" value="testval" checked=1} That's sort-of specious because actually, it isn't easier at all, perhaps even harder. "Easier" here isn't just about using less characters--it is about imparting unambigous meaning concisely, and IMHO, the first example fails that test. Best Regards, xo boots __________________________________ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/

« previous php.smarty.dev (#1954) next »