HTML entity syntax
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? Cheers. Alexandre
There is a distinct difference between the &dtml-varname; syntax and the other more normal way. The difference is that &dtml-varname; 'escapes' the variable being rendered, it is therefore useful when creating url's from object name/contents etc. if you were to try doing a page like this: &dtml-standard_html_header; &dtml-page_content; &dtml-standard_html_footer; You'll have a surprise as it gets 'escaped' and shows the code in the browser rather than the rendered version! HTH Phil phil@wigwamweb.net |>-----Original Message----- |>From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of |>Alexandre Ratti |>Sent: Wednesday, November 03, 1999 12:10 PM |>To: zope@zope.org |>Subject: [Zope] HTML entity syntax |> |> |>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? |> |> |>Cheers. |> |>Alexandre |> |>_______________________________________________ |>Zope maillist - Zope@zope.org |>http://lists.zope.org/mailman/listinfo/zope |> |>(Related lists - please, no cross posts or HTML encoding! |> |>To receive general Zope announcements, see: |>http://lists.zope.org/mailman/listinfo/zope-announce |> |>For developer-specific issues, zope-dev@zope.org - |>http://lists.zope.org/mailman/listinfo/zope-dev ) |>
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 ------------------------------------------
participants (3)
-
Alexandre Ratti -
Martijn Pieters -
Phil Harris