[Zope] HTML entity syntax
Martijn Pieters
mj@antraciet.nl
Wed, 03 Nov 1999 14:07:51 +0100
At 13:10 03/11/99 , Alexandre Ratti wrote:
>Hello,
>
>
>I came across the HTML entity syntax for variables (eg. using &dtml-myVar;
>instead of <dtml-var myVar>).
>
>I find it very interesting to simplify DTML code. I'll write up a tip.
>
>It doesn't seem widely used, though. It doens't show up often on this
>mailing list. Are there any reason not to use it?
I do use it a lot, but the plain &dtml-varname; syntax is intended for use
within HTML tag attributes, and as such will insert the variable HTML
quoted. So if you include &dtml-standard_html_header; you'll find your
header HTML source in the browser, instead of it's rendered HTML.
In the upcoming version 2.1.0, the syntax has been extended. You can then
specify var tag options, which influence the formatting. Some examples:
&dtml-var; # HTML quoted
&dtml.html_quote-var; # Same
&dtml.url_quote-var; # URL quoted
&dtml.upper-var; # All in uppercase
&dtml.url-var; # The absolute URL of the object, not the
object itself (new in 2.1).
&dtml.-var; # Verbatim, unformatted.
You can also combine:
&dtml.html_quote.upper-var;
for an all-caps HTML quoted version. If you want it, that is. =)
--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------