Re: [Zope] - Yet another stupid question: image folders
At 04:40 PM 12/7/98 -0500, Christopher G. Petrilli wrote:
On Mon, Dec 07, 1998 at 04:35:43PM -0500, Phillip J. Eby wrote:
<!--#with images--><!--#var logo--><!--#/with-->
This works, but I'm gonna whine that it's WAY too much typing :-)
Well, if you do this a lot, define a 'logo' document which contains it, then everywhere else you'll only need to call it once. If you want it to be more dynamic, make a 'showSubImage' document and make it say: <!--#with imgFolder--><!--#var "_[imgName]"--><!--#/with--> And then call it with: <!--#var "showSubImage(imgFolder=images,imgName='logo')"--> Unfortunately, this is actually longer than the original 'with' version, but at least it shows off some DTML hacking techniques. :)
Prefferable (though currently illegal) would be:
<!--#var logo with=images-->
Ugh. Please don't go there.
Somehow I think this could be useful for a lot of things... just don't ask me what else. Alas, I think this is how Perl got the way it is.
Yep. :) Always be wary of taking an initially simple and clever idea and then beating it to death with a dead horse, or something like that. :)
This is sounding to me like 1) a cool feature; and b) a new tag. Howbout a general "html" or "link" or "href" tag: <!--#link name="logo.gif" fmt="img"--> or some such. Then the magical elveZ would say, "image, better find out how big it is, blah blah"... I know new tags are the wrong (perl) way to go, but if they are general enough... Thus, better to go with #link or #href rather than #img... Keep it general. Because printing an "image" object out shouldn't give more than either its name or URL. It certainly shouldn't spit out any HTML code, which is what this dude is wanting to do. On Mon, 7 Dec 1998, Phillip J. Eby wrote:
At 04:40 PM 12/7/98 -0500, Christopher G. Petrilli wrote:
On Mon, Dec 07, 1998 at 04:35:43PM -0500, Phillip J. Eby wrote:
<!--#with images--><!--#var logo--><!--#/with-->
This works, but I'm gonna whine that it's WAY too much typing :-)
Well, if you do this a lot, define a 'logo' document which contains it, then everywhere else you'll only need to call it once. If you want it to be more dynamic, make a 'showSubImage' document and make it say:
<!--#with imgFolder--><!--#var "_[imgName]"--><!--#/with-->
And then call it with:
<!--#var "showSubImage(imgFolder=images,imgName='logo')"-->
Unfortunately, this is actually longer than the original 'with' version, but at least it shows off some DTML hacking techniques. :)
Prefferable (though currently illegal) would be:
<!--#var logo with=images-->
Ugh. Please don't go there.
Somehow I think this could be useful for a lot of things... just don't ask me what else. Alas, I think this is how Perl got the way it is.
Yep. :) Always be wary of taking an initially simple and clever idea and then beating it to death with a dead horse, or something like that. :)
- AEZ
At 05:22 PM 12/7/98 -0500, Andrew Zeldis wrote:
This is sounding to me like 1) a cool feature; and b) a new tag.
Howbout a general "html" or "link" or "href" tag:
<!--#link name="logo.gif" fmt="img"-->
or some such. Then the magical elveZ would say, "image, better find out how big it is, blah blah"...
I know new tags are the wrong (perl) way to go, but if they are general enough... Thus, better to go with #link or #href rather than #img... Keep it general.
I disagree with this rather strongly, on two grounds. First, DTML is not just for generating HTML - it's also used for generating SQL, plain text, e-mail, and in ASDF it will soon be used to generate Perl and shell scripts(!). I would much rather it stayed a (relatively) lightweight general text processing language and did not include ANY HTML-specificness. AFAIK, it is currently language-neutral other than providing HTML, URL, and SQL quoting mechanisms. Second, it is a very small language, and I really like it that way. In evangelizing it, I tell people, look, it only really has four keywords: var, if, in, and unless. (This was before 'call', 'with', and 'raise' were added, I guess I should update my spiel. :) ) I can shame any programmer into learning it simply by saying, "Hey, you mean to tell me you can't learn a language with only four primitives?" :) I would be happiest if there were never more than seven primitives in DTML - anyone can learn seven things. Of course, I'm probably an extremist, but I don't think that 'sendmail', 'tree', or even 'raise' should be built in as tags. Make 'em methods like everything else and use 'call' or 'var' to insert them. My nightmare is that now that there's an easy protocol and examples for creating new tags, there will arise 500 different dialects of DTML, all mutually incompatible... And when you try to install a product made with one definition of say, 'sendmail', it will break the installation of another product made with a different definition, because the DocumentTemplate libraries are global. Shades of MS-Windows shared DLL's! On the other hand, there is something that would probably fix that problem... If DocumentTemplate tried to look up an attribute in itself called (say) 'DTML_Tag_foo' where foo was the name of a tag it didn't recognize, then subclasses of DocumentTemplate could extend the language without altering a global resource. Perhaps I should submit a patch for that... :)
Phillip> In evangelizing it, I tell people, look, it only really has Phillip> four keywords: var, if, in, and unless. (This was before Phillip> 'call', 'with', and 'raise' were added, I guess I should update Phillip> my spiel. :) ) Of course var using the expr attribute can expand the complexity of the language fairly significantly... Skip Montanaro | Mojam: "Uniting the World of Music" http://www.mojam.com/ skip@calendar.com | Musi-Cal: http://concerts.calendar.com/ 518-372-5583
participants (3)
-
Andrew Zeldis -
Phillip J. Eby -
skip@calendar.com