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

From: Date: Wed, 10 Dec 2003 11:55:06 +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-1958@lists.php.net to get a copy of this message
Boots writes: > hmm. At first glance that seems reasonable enough, though I don't think > I favour it. It doesn't seem like a big gain to me compared to > {* somefunc somevar=someval *} > though I submit that it is somewhat a matter of taste. The nested comments is one advantage, albeit a small one. It's useful for much the same reason end of line comments are in most programming langauges - there's never really a situation where block comments cannot be used instead, but sometime's its simpler. If I'm trying to test the effect of a single Smarty element, for example, it's quick to change {tag to {// tag, hit save and refresh the browser to see the effect. Changing both { to {* and } to *} means a lot more moving around the code and is therefore considerably slower, particularly when you have a lot of length elements to move around. FWIW, the actual code I was playing with yesterday was: {include x=155 y=205 file="blocks/genie.motor_current.tpl"} {include x=370 y=10 file="blocks/genie.bypass_position.tpl"} {include x=370 y=55 file="blocks/genie.inlet_position.tpl"} {include x=0 y=120 phase="A" label="R" file="blocks/genie.phase_motor_stator.tpl" } {include x=0 y=205 phase="B" label="S" file="blocks/genie.phase_motor_stator.tpl" } {include x=0 y=290 phase="C" label="T" file="blocks/genie.phase_motor_stator.tpl" } {include x=370 y=-1 file="blocks/genie.oil_temp.tpl"} {include x=220 y=-1 file="blocks/genie.oil_pressure.tpl"} {include x=0 y=10 file="blocks/genie.comp_status.tpl" } Using an editor (like UltraEdit, which I use) that supports column editing, inserting the // (or xx) at the start of each include takes very little time. Finding the end of each line is much more time consuming. The purpose of the change was that one of those lines was causing a problem and I wanted to disable them all and re-enable them one at a time to find out which. Putting {* at the top and *} at the bottom, then shifting the {* down a line at a time, would have achieved the same result, as I'm sure someone will point out if I don't. But this isn't as easy if you find you need to enable the first, third and fifth lines only... > Of course, messju said it right: comments are not the best way to > switch off code and by implementing "xx" as a compiler function, you > can achieve your original intention. This is the actually the ideal solution, and one I didn't know existed; it works perfectly! Thanks to both of you for pointing it out! All of which makes me glad I asked the original question; I've learnt quite a bit as a result. -- Mark Rogers, More Solutions Ltd

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