[Zope] Re: Trouble with dtml-with

Jaroslav Lukesh lsh@wo.cz
Fri, 15 Nov 2002 17:53:09 -0000


Toto je vícedílná zpráva formátu MIME.

------=_NextPart_000_01C28CCF.DC018040
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: Quoted-Printable

| Odes=EDlatel: Roger Fisher <rlfisher@sprynet.com>
| Thanks to all the helpful replies I had for my need for a "dynamic"
| <dtml-with>.
| "_.getitem(StringOfObject)" works beautifully.  I have a similar
additional
| newbie problem:
|=20
| FolderA
| ...FolderB
| ...FolderC
| ......FolderD
| ......Method1
|=20
| Method1 (in FolderC) has no problem, of course, doing a <dtml-with
FolderD>
|=20
| I cannot figure out how to <dtml-with> to get from Method1 (in FolderC)
to
| code in FolderB.  FolderB is parallel to Method1's parent (FolderC).

Take look at code in attachment. Here is nice recursive access method in
pure DTML.

May it help you. It is from early Zope mailing list archive and I use it.

Regards J. Lukesh
------=_NextPart_000_01C28CCF.DC018040
Content-Type: application/octet-stream; name="recurse folder"
Content-Disposition: attachment; filename="recurse folder"
Content-Transfer-Encoding: 7Bit

Subject: RE: [Zope] Mapping a site
Date: Wed, 25 Aug 1999 14:01:40 +1000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Content-Type: text/plain;
	charset="iso-8859-1"

Heres the method I use for my sitemap. It puts in the site map only
documents, files and images that have a title. Anything else is considered
not sitemap material. 

You can ignore the "canView" statements or replace them with the Zope2
has_permission function.

---recurseFolder---

<ul>
  <!--#in "objectItems(['DTML Document','Image','File'])"
skip_unauthorized-->
  <!--#if "canView(_.getitem('id',1), AUTHENTICATED_USER)"-->
  <!--#if "_.getitem('id',1) != 'index_html' and title != ''"-->
   <li><a href="<!--#var "absolute_url()"-->"><!--#var title--></a>
   <!--#if "(ZopeTime() - bobobase_modification_time()) < 14"-->
    <img src="<!--#var "images.imgNew.absolute_url()"-->" alt="*NEW*">
   <!--#/if-->
   </li>
  <!--#/if-->
  <!--#/if-->
  <!--#/in-->

  <!--#in "objectItems(['Folder'])"-->
  <!--#if "title != '' and canView(id,AUTHENTICATED_USER)"-->
   <li>
     <a href="<!--#var "_.getitem(id).absolute_url()"-->"><!--#var
title--></a>
   </li>
   <!--#with sequence-item-->
     <!--#var recurseFolder-->
   <!--#/with-->
  <!--#/if-->
  <!--#/in-->
</ul> 

---SiteMap---

<!--#var standard_html_header-->
<!--#with aq_parent-->
<!--#var recurseFolder-->
<!--#/with-->
<!--#var standard_html_footer-->

> -----Original Message-----
> From: Andreas Kostyrka [mailto:andreas@mtg.co.at]
> Sent: Tuesday, August 24, 1999 04:38
> To: Arnaud Lecat
> Cc: ZOPE
> Subject: Re: [Zope] Mapping a site
> 
> 
> On Mon, 23 Aug 1999, Arnaud Lecat wrote:
> 
> Well, for an live example, I'll paste here the navigation 
> sidebar method
> from www.mtg.co.at:
> <!--#with "PARENTS[-1]"-->
> <A HREF="/"><!--#var logo_or_title--></A><BR>
> <BR>
> <!--#/with-->
> <!--#tree
>   expr="PARENTS[-1]"
>   branches_expr="navigate_filter('donav','yes','Folder')"
>   skip_unauthorized=1 sort=title_or_id
>   -->
> <A HREF="<!--#var absolute_url-->"><!--#var title_or_id--></A>
> <!--#/tree-->
> 
> 
> > I still don't manage to do what I want to do ;( User Folder 
> is still shown in
> > the
> > tree, folders with donav='false' properties are still 
> shown... Everything's go
> Well, if you used
> navigate_filter('donav',_.None)
> 
> then folders with donav='false' would be matched: _.None 
> means any value.
> 
> Andreas
> --
> Andreas Kostyrka                     | andreas@mtg.co.at
> phone: +43/1/7070750                 | phone: +43/676/4091256   
> MTG Handelsges.m.b.H.                | fax:   +43/1/7065299
> Raiffeisenstr. 16/9                  | 2320 Zwoelfaxing 
> AUSTRIA        
> 
> 
> 
 
------=_NextPart_000_01C28CCF.DC018040--