[Zope] Clever solution wanted

Mario Valente mvalente@ruido-visual.pt
Tue, 22 Jan 2002 11:25:27 +0000


At 12:09 22-01-2002 +0100, Tille, Andreas wrote:
>I have the following problem:  The web pages of our institute has a
>menu frame (please don't throw anything at me about the frames - I do not
>like it but now I have to cope with it) with links.  Those links have
>the following structure:
>
>    <a href="URL1"> target="target-frame1">text1</a><p>
>    <a href="URL2"> target="target-frame2">text2</a><p>
>    <a href="URL3"> target="target-frame3">text3</a><p>
>    ...
>

>I'm looking for a more clever solution than I could imagine (as a
>quite beginner in Zope).
>

  Create a ZClass called MenuItem which has 3 properties (urlText,
 targetFrame, displayText).

  Inside a folder called Menu (or whatever) allow only the creation of
 class MenuItem instances (objects). Your editors should be allowed
 to instantiate how many of those they want (you should probably use
 some kind of object Id generation; dont let the editors choose the ids
 themselves). The only other item in this folder should be a DTML
 method with something like this

    <dtml-in "objectValues(['MenuItem'])">
       <a  href="<dtml-var urlText>"   target="<dtml-var targetFrame>" >
<dtml-var displayText> </a> <p>
    </dtml-in>

  If you put this "Menu" folder on the root of your Zope, you can call the
menu anywhere
 with a simple <dtml-var Menu>

  C U!

  -- Mario Valente