[Zope] Sequence number inside a tree

Jaroslav Lukesh lsh@wo.cz
Thu, 7 Nov 2002 14:52:04 -0000


| Odes=EDlatel: Alfredo P. Ricafort <alpot@mylinuxsite.com>
| Is there a way to generate a sequence number inside a <dtml-tree> or
| replace the + sign with a sequence number?=20
| 1. Branch_1
|    1.1 Branch_1.1
|    1.2 Branch_1.2
|        1.2.1 Branch_1.2.1
| 2. Branch_2
|    2.1 Branch_2.1
|    2.2 Branch_2.2

You can simpple modify code that you will find below. I have used at simp=
le
sitemap generation. But I have problem that you need run it from
subdirectory of directory that you want to display. But it is maybe my
error.

Have you take look at mail archive? I have that code form it (I have not =
in
file original author, but it could be searched in archive by searching
Subject: RE: [Zope] Mapping a site    or search by date: Date: Wed, 25 Au=
g
1999 14:01:40 +1000):
=20
I have done little simplification:

File SiteMap:
<html><head></head><body>
<!--#with aq_parent-->
<!--#var SiteMap_recurse_folder-->
<!--#/with-->=20
</body></head>=20

File SiteMap_recurse_folder:
<ul>
  <!--#in "objectItems(['Folder', 'LinkedFolder','PortableHole'])"-->
  <!--xx#if "has_permission(id,AUTHENTICATED_USER)"-->
   <li>
     <a href=3D"<dtml-var "_.getitem(id).absolute_url()">/manage"><dtml-v=
ar
title_or_id></a> <small><dtml-var meta_type></small> [=20
              <!--#if "(ZopeTime() - bobobase_modification_time()) <
2"--><b><!--#/if-->
              <dtml-var bobobase_modification_time fmt=3D"%d.%m.%y %H:%M"=
>=20
              <!--#if "(ZopeTime() - bobobase_modification_time()) <
2"--></b><!--#/if-->]
   </li>
   <!--#with sequence-item-->
     <!--#var SiteMap_recurse_folder-->
   <!--#/with-->
  <!--xx#/if-->
  <!--#/in-->
</ul>
-----------------------

Simple place <dtml-let xx=3Dsequence number> (or so) in that place:

........
   <!--#with sequence-item-->
	<dtml-let xx=3Dsequence number>
     <!--#var SiteMap_recurse_folder-->
	</dtml-let xx>
   <!--#/with-->
.......

and do display number like that:
........
<dtml-var xx><dtml-var title_or_id>
.....

These modificationa are not tested, but sitemap works for me fine.

Of course, you can do use <ol><li> in HTML and you will get numbering at
browser side.


Regards JL.