[Zope] <dtml-tree> question

Martijn Pieters mj@antraciet.nl
Sun, 22 Aug 1999 11:56:36 +0200


At 04:23 22-8-99 , Tim Wilson wrote:
><SPAN CLASS=tree>
>  <!--#tree particle branches_expr="objectValues(['Folder', 'DTML
>Document'])" sort=id-->
>    <!--#if expr="meta_type == 'Folder'"-->
>      <!--#if tree-item-expanded-->
>        <IMG SRC="<!--#var SCRIPT_NAME-->/HelpSys/hs_obook" ALIGN="TOP"
>BORDER="0" width=16 height=16>
>      <!--#else-->
>        <IMG SRC="<!--#var SCRIPT_NAME-->/HelpSys/hs_cbook" ALIGN="TOP"
>BORDER="0" width=16 height=16>
>      <!--#/if-->
>      <!--#var title_or_id-->
>    <!--#else-->
>      <IMG SRC="<!--#var SCRIPT_NAME-->/HelpSys/hs_dnode" ALIGN="TOP"
>BORDER="0" width=16 height=16>
>      <A HREF="<!--#var "particle.absolute_url()"-->/
>         <!--#var tree-item-url-->?
>         <!--#if tree-s-->tree-s=<!--#var tree-s--><!--#/if-->
>         <!--#if tree-e-->&tree-e=<!--#var tree-e--><!--#/if-->
>         <!--#if tree-c-->&tree-c=<!--#var tree-c--><!--#/if-->">
>      <!--#var title_or_id--></a>
>    <!--#/if-->
>  <!--#/tree-->
></SPAN>
>
>I don't see any extra whitespace in there. BTW, I haven't figured out the
>purpose of <!--var SCRIPT_NAME>. To what does that refer?

When Tom Deprez turned my code into a tutorial, he added some whitespace for
readability, but did so in some places that make the example somewhat unusable.
Any whitespace in between DTML tags in the URL generating part of the code will
turn into whitespace in the generated URLs, and should therefore be removed. It
starts at HREF="<!--#var "particle.absolute_url()"--> and ends at <!--#/if-->">
(note the "> there). You can have whitespace _within_ the DTML tags, but not in
between them. Putting the whole thing on one line will solve your problem.

The <!--#var SCRIPT_NAME--> will insert the path to your Zope installation.
This is only really necessary for sites using Apache or another Webserver,
where the Zope root folder is not ate the root of the website. If you can reach
Zope through the URL 'http://your.site.com/Zope/' then SCRIPT_NAME will be
'/Zope'. This way you are sure that wherever you place this script, you will
always be able to reference the icons properly.


-- 
Martijn Pieters, Web Developer 
| Antraciet http://www.antraciet.nl 
| T: +31 35 7502100 F: +31 35 7502111 
| mj@antraciet.nl http://www.antraciet.nl/~mj 
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 
---------------------------------------------