Re: [SMARTY-DEV] nested comments

From: Date: Thu, 11 Dec 2003 22:23:05 +0000
Subject: Re: [SMARTY-DEV] nested comments
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1977@lists.php.net to get a copy of this message
I don't think you'd ever have to go any deeper than {** **}. This would be used only for commenting large blocks of template code, which can include any kind of content except for {** **} itself. Then you configure your text editor to grey out text between {** **} and then the commented blocks become extremely visible :) Getting normal comments to nest properly isn't going to happen unless we do something drastic to the tokenizer (move away from preg as the parser) On Thu, 2003-12-11 at 16:03, boots wrote: > --- Monte Ohrt <monte@ispi.net> wrote: > > I can see where it would be nice to cleanly comment out a block of > > code you are working on. example: > > > > {** > > {* func1 doesn't work yet! *} > > {func1 foo=bar (??) } > > **} > > > > The difference between {** **} and a {if 0}{/if} is that the > > tokenizer > still parses things between the {if} statements, so you > > could possibly get broken stuff. > > Well, that mostly shuts me up :) I have to admit the syntax choice is > clever since to the parser will happily strip those comments out in the > same way it strips {* *}--all that is needed is for the parser to > recognize them as distinct from {* *}. > > Of course, I can imagine someone then suggesting {*** ***}. The logical > culminatation is someone suggesting {*..n *..n} where *..n is an > arbitrary number of asterisks. Probably not too hard to implement, > all-in-all, but it can lead to weird looking template code, if you ask > me. > > It seems that the win-win situation is to get normal comments to nest > properly. :) > > > That, and it is immediately recognizable that {** **} are comments. > > An {if 0}{/if} might be confusing to someone else reading your > > template. > > This part I don't buy, since {if 0} is a very common technique in other > languages (like PHP) but mainly because this is exactly the type of > thing that shouldn't survive from developer to developer. There are few > things more confusing than inheriting code that has commented out > sections. What is the next developer to make of that? > > I wonder if this should be done using a custom filter so people can use > any darn symbology they want to hide things from the compiler. After > all, this is comparable to pre-processor issues. > > Anyone else? > > xo boots > > __________________________________ > Do you Yahoo!? > New Yahoo! Photos - easier uploading and sharing. > http://photos.yahoo.com/

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