[ZDP] Printable version of Tom's version of ZBook
Martijn Pieters
mj@antraciet.nl
Wed, 19 May 1999 10:32:18 +0200
At 00:31 19/05/99 , Tom Deprez wrote:
>Hi Martijn,
>
>Can you explain me a little about your code? Thanks!
Sure
><!--#in "objectValues(['Folder', 'DTML Document'])"-->
>
>(What does this tag in now exactly do? Recursively iterate through all
>Folders and DTML documents?)
The call to 'objectValues' returns a list of objects contained in the
current Folder. In this case, I specifically want to see objects with
meta_types 'Folder' and 'DTML Document'. This method does not recurse! It
only operates on the current Folder (because I placed this statement in a
DTML Method).
With the #in tag I iterate through this list. Within the #in tag you are
within the namespace of the current object in the list. So all code up to
the #/in tag operates on the objects returned by the objectValues call.
><!--#if "meta_type == 'Folder'"-->
>
>(now I understand this :-) )
So if this object is a Folder, then:
><h2><!--#var title_or_id--></h2>
><blockquote><!--#var zb_all_view--></blockquote>
>
>(what does zb_all_view contains here (zb_all_view is the id DTML of this
>DTML Method)? What does it do?)
Display it's title (or id if it doesn't have a title), and call the
zb_all_view method in that Folder, and place the outcome in blockquotes
(indent). zb_all_view is indeed the same DTML Method, but acquired into
this subfolder. It does exactly the same, only now for that subfolder. It
lists all subfolders of that subfolder and it's DTML Documents, and calls
zb_all_view on those subsubfolders... This is the recursion and acquisition
magic. We just call ourselves with new data, in this case a new folder on
which to call objectValues.. No more subfolders => end of recursion.
><!--#else-->
else this is not a Folder, but a DTML Document
><!--#with "_.namespace(standard_html_header='', standard_html_footer='')"-->
>
>(what does _.namespace do?) Remove these parts (header, footer) from
>content?
Yes. Here we are going to render the DTML Document. It normally uses the
acquired header and footer, which include the navigation tree! So by
replacing the header and footer with two empty variables, I pull only the
real content from the DTML Document.
><!--#var sequence-item-->
>
>(What is sequence-item here? The Content? ie. a chapter part)
sequence-item is the current object within the #in tag. This tag calls
it, so tells it to render itself. The result of that call is put into this
document.
><!--#/with-->
><!--#/if-->
><!--#/in-->
>
>Tom.
--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------