[Zope] uses for lines, token properties?
Philip Aylesworth
zopelist@regalint.com
Thu, 06 May 1999 08:58:12 -0400
Craig Allen wrote:
>
> The documentation seems sparse to nonexistent on the subject of the
> lines and tokens property types. And I've seen reference to a tuple
> property type, but it's not an option using the UI.
> Could someone enlighten me as to the uses of these properties?
Tokens are just a list of words, lines are a list of lines. In each case
you can scan through them. If you need spaces use lines.
I think Ztables does tuples but I haven't had time to look at it yet.
Here is some code that I originally stole from zope.org. Don't tell! :)
<!--#if menu_contents-->
<H4><!--#var title_or_id--></h4>
<p>
<!--#in menu_contents-->
<!--#if sequence-item-->
<!--#var expr="REQUEST.set('sc',
_.string.split(_vars['sequence-item'],'|'))" fmt=""-->
<!--#if expr="PATH_INFO == sc[1]"-->
<IMG WIDTH="8" HEIGHT="12" ALIGN="top" SRC="<!--#var
BASE1-->/images/arrow" BORDER="0" VALIGN="center">
<STRONG> <!--#var expr="sc[0]"--><BR></STRONG>
<!--#else-->
<IMG WIDTH="8" HEIGHT="12" ALIGN="top" SRC="<!--#var
BASE1-->/images/blank" BORDER="0" VALIGN="center">
<A HREF="<!--#var BASE1--><!--#var expr="sc[1]"-->">
<!--#var expr="sc[0]"--></A><BR>
<!--#/if-->
<!--#/if-->
<!--#/in-->
</P>
<!--#/if menu_contents-->
menu_contents is a lines property of the folder. If it doesn't exist is
is inherited. So you only need to declare it when you want the menu to
change. Each line is a menu item and a URL seperated by a '|'. The code
splits it. It even checks if a URL is the current URL and puts in a
pointer and the menu item in bold.
(Full credit to zope.org, It would have taken me forever to come up with
this!)
Phil A.
> I know I can iterate thru lines, and if I knew more about parsing
> strings in the Zope environment I could probably use them as I would
> like (generating links to anchors in a document body [that I'll hard
> code anchors into]).(He said, sneakily embedding yet another
> question...)
This code should help with this, too!