[Zope] Var includes

Shaw, Howard ShawH@STHS.org
Wed, 24 Feb 1999 09:27:37 -0600


Well, I thought this would do, so I let it sit while I built a new
webserver. Now I am back to work on Zope, sitting on my new server, and
I find that I'm not sure I fully comprehend these instructions. 

What I need to do, is to 'include,' in the same way the default document
says '<!--#var standard_html_header-->' a document whose location I
receive from an sql query in the form of 'dir/dir/dir/.../file' with an
arbitrary number of directories. It is not an object whose namespace I
need to enter. Rather, I need to get into the namespace of the last dir,
so I can #var include the file.

Please help.

> ----------
> From: 	Martijn Pieters[SMTP:mj@atmm.nl]
> Sent: 	Friday, February 19, 1999 10:55 AM
> To: 	Shaw, Howard; 'Pavlos Christoforou'; 'Zope@zope.org'
> Subject: 	RE: [Zope] Var includes
> 
> >Do I have to write an External Function to split the directory and
> >perform the equivalent of nested <!--#with-->'s to include this? I
> had
> >hoped for a simple DTML based solution.
> 
> <!--#in expr="_.string.split(location, '/')"-->
>   <!--#if sequence-start-->
>     <!--#call "REQUEST.set('strFolder', _['sequence-item'])"-->
>   <!--#else-->
>     <!--#call "REQUEST.set('strDocument', _['sequence-item'])"-->
>   <!--#/if-->
> <!--#/in-->
> 
> Now we have altered the namespace. Now, these objects, are they _IN_
> the
> current folder (i.e. in folder temp_people the folder uid the object
> studinfo)?
> Then you do:
> 
> <!--#in expr="_.getitem(strFolder).objectItems(['Folder'])"-->
>   <!--#if "_['sequence-key'] == strDocument"-->
>     <!--#with sequence-item-->
>        <!--#var title-->        <== now in the namespace of the
> subobject
>     <!--#/with-->
>   <!--#/if-->
> <!--#/in-->
> 
> Took me a minute, but it works.
> 
> 
> --
> M.J. Pieters, Web Developer
> | ATMM http://www.atmm.nl
> | Tel: +31-35-6254545 Fax: +31-35-6254555
> | mailto:mj@atmm.nl http://www.atmm.nl/~mj
> | PGP:
> http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
> ------------------------------------------
>