[Zope] Difference between &dtml-myvar; and <dtml-var myvar>

andres@corrada.com andres@corrada.com
Thu, 15 Jun 2000 22:18:24 -0400


On Thu, Jun 15, 2000 at 12:47:17PM -0700, Hung Jung Lu wrote:
> This has been something that I've never been very careful about. Until I got 
> bitten in generating a JavaScript.
> 
> What is the difference between
> 
>   <dtml-var myvar>
> 
> and
> 
>   &dtml-myvar;
> 
> ?
> 
> I have noticed some differences before, but I don't remember the details, 
> now. I guess one of them mangles the result so it can be looked at in a 
> browser (properly HTML quoted?)
> 
>   <dtml-call "REQUEST.set('myvar', '&')">
>   <dtml-var myvar><br>
>   &dtml-myvar;<br>
> 
> Visually they look the same, but if I looked at the source:
> 
>   &<br>
>   &amp;<br>
> 
> Is the a technical term (e.g: "rendering", "HTML-quoting", etc.) that 
> describes the difference in the output?
> 
> regards,
> 
> Hung Jung
> 

From the Using the DTML entity syntax How-To
(http://www.zope.org/Members/AlexR/EntitySyntax) :

"The &dtml-myVar; syntax is intended for use within HTML tag attributes, and
as such will insert the variable HTML-quoted. This means that characters
that have a special meaning in HTML (such as <, >, or &) will be replaced by
the corresponding entities. So if you include &dtml-standard_html_header; in
a page you'll find your header HTML source in the browser, instead of
rendered HTML."

------------------------------------------------------
Andres Corrada-Emmanuel   Email: andres@corrada.com
------------------------------------------------------