[Zope] Building multiple documents from fragments(objects).
Andy McKay
andym@ActiveState.com
Wed, 4 Apr 2001 09:50:10 -0700
You can use <dtml-in > to iterate over a list, have a look in the docs.
So you could do:
<dtml-in "[1,2,3]">
<dtml-var sequence-item>
</dtml-in>
Or if you have some way of differentiating fragment from other stuff:
<dtml-in stuff>
...
</dtml-in>
Cheers.
--
Andy McKay.
----- Original Message -----
From: "Alan Young" <alany@idiglobal.com>
To: <zope@zope.org>
Sent: Wednesday, April 04, 2001 9:23 AM
Subject: [Zope] Building multiple documents from fragments(objects).
> Hello All,
>
> I have some newbie questions.
>
> I'm an experienced perl programmer trying to learn Zope/Python and am
> trying to do something I know must be possible, but am having a hard
> time wrapping my brain around this new way of doing things.
>
> I have a bunch of document fragments with the following structure:
>
> /docs
> fragment1
> fragment2
> fragment3
> ...
> doc1/
> index_html
> doc2/
> index_html
>
> Currently, doc1/index_html and doc2/index_html have the following
> structure:
>
> <dtml-var standard_html_header>
> <h1><dtml-var title_or_id></h1>
>
> <div><h3>fragment1 title</h3>
> <ul>
> <li><dtml-var fragment1></li>
> </ul>
> </div>
>
> <div><h3>fragment2 title</h3>
> <ul>
> <li><dtml-var fragment2></li>
> </ul>
> </div>
>
> <div><h3>fragment3 title</h3>
> <ul>
> <li><dtml-var fragment3></li>
> </ul>
> </div>
>
> ...
>
> Is there a way that I can do something like this (warning: It's a clunky
> mix of perl and dtml):
>
> for my $f ( qw( fragment1 fragment2 fragment3 ) ) {
> <div><h3><dtml-var $f-title</h3>
> <ul>
> <li><dtml-var $f></li>
> </ul>
> </div>
> }
>
> I would prefer to do this entirely in dtml if at all possible (I need to
> show non-programmers how to do this if I can make it work and they don't
> wanna know about Python or Perl stuff).
>
> Failing that, is there a way I can do this generically enough that a
> designer could just use a dtml tag and pass the necessary values?
>
> Thanks for your input.
>
> Alan
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>