Re: [PHP Template] Recursive hide behavior

From: Date: Fri, 03 Mar 2000 16:07:26 +0000
Subject: Re: [PHP Template] Recursive hide behavior
References: 1 2 3 4 5 6  Groups: php.template 
Request: Send a blank email to php-template+get-299@lists.php.net to get a copy of this message
Andrei Zmievski wrote: > > On Wed, 01 Mar 2000, Dan Libby wrote: > > From a syntax perspective, 3 & 4 should be identical, so long as both have unique > > ids. 1 & 2 are nice to have, but not strictly necessary, since all > > variables/sections could be explicitly listed. For completeness, none should also > > be an option, even though it is the default. (HTML usually works that way) > > > > So I would see the syntax as looking like: > > > > autohide="all" or > > autohide="sections" or > > autohide="vars" or > > autohide="$section1" or > > autohide="$section1,$var1" or > > autohide="sections,$var1" or > > autohide="vars,$section1" > > Well, I don't think we should put $ in front of sections... They are not > really variables. We'd have to do something like: > > autohide=#vars,section1 > > But #vars is not really a variable. Hmm, maybe > > autohide=<variables>/<sections>, some examples: > > autohide=all > autohide=vars/section1 > autohide=$var1,$var2/sections > > Or use ':' instead of '/', and use '/' for referring to section > variables like $section1/foo. Sort of like a 'path' to a variable. > > > An alternative syntax that may be easier to parse is to have multiple autohide > > statements, eg: > > > > {{section:foo autohide="section1" autohide="$var1"}} > > I thought about this, but then what if you have autohide="$var1" > autohide="all"? Ambiguity land. > > BTW, I was thinking we'd use " only for constant strings, not to > delimiter attribute values. > > -Andrei > > "Later in this talk, I intend to define > the universe and give three examples." -- Larry Wall > I've been trying some different situations, and I think we can live with this subset of functionality: autohide=none autohide=all autohide=any autohide=vars autohide=sections I haven't found a situation where I actually need finer control, but if you *really* need more control on a per variable or section basis, you can overcome this with IF logic and more section wrappers. I bit more work for these rare cases, but this keeps the language syntax easy. default might be autohide=all. Let me know if you have situations where you need more control, we'll take a look. Here is an example. I threw in the {{altsection}} tag just to spur some discussion :-) <TABLE> <TR> {{section sec1 autohide=all}} <TD>Category: {{ $category }}</TD> {{section sec2 autohide=any}} {{* this section hides if headline OR date are emtpy *}} <TD> Article: {{ $article_headline }} Date: {{ $article_date }} </TD> {{altsection}} {{* this displays if sec2 was hidden *}} <TD> No articles to show </TD> {{/section}} {{/section sec1}} </TR> </TABLE>

« previous php.template (#299) next »