[Zope] Syntax

Paul Zwarts paz@oratrix.com
Thu, 12 Jul 2001 14:53:44 +0200


The best bet is to check the DTML Users Guide. Although it is a long hard
stare. Check the Zope book as well for fundamentals.

>>>Is this refering to an earlier item in the sequence?

<dmtl-in list>
  <dtml-if "_['sequence-index']==5">This is the fifth occurance</dtml-if>
</dtml-in>

Yes indeed.

>>>Is it the same as _.sequence-item-5 ?

The above is not possible. Remember that _ has a dual function. It A)
accesses namespace:

_.string.find('stringname, 'findStringText')

_ pushes the results of the method into namespace.



_.int(string)

and so on...

_['some-name'] has NOTHING to do with namespace. It only prevents 'some'
being subtracted by 'name', when you intend some-name to be only one object.


>>>If I have a name clash (two Z SQL Method's return ID), how to I look up
the
stack of namespaces?

Dont use ID as good practice, since ID is the document ID. BUT you can
return REQUEST['id'] which is the REQUEST variable and not necessarily the
Zope object ID. If you have multiple ID used in a nested <dtml-in> the ID
resulted is owned by its superior IN.

Forinstance, I add an 'a' or 'b'to ID to show:

<dtml-in methoda>    <-- You will return an ID here-->
  <dtml-var ID>
  <dtml-in methodb>  <-- You will return an another ID here-->
    <dtml-var ID>
  </dtml-in>
<dtml-in>

Now I a the result

<dtml-in methoda>    <-- You will return an ID here-->
  <dtml-var ID(a)>
  <dtml-in methodb>  <-- You will return an another ID here-->
    <dtml-var ID(b)>
  </dtml-in>
<dtml-in>

AFIAK. Possibly not.


If you want to look up namespace, simply put

<dtml-var REQUEST>
in the bottom of your page and you will see all.....


Paz



-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of J.
Cone
Sent: Thursday, July 12, 2001 2:30 PM
To: Paul Zwarts; benoit.dominiak@makinacorpus.com
Cc: Zope
Subject: RE: [Zope] Syntax


At 14:24 12/07/01 +0200, Paul Zwarts wrote:
<snip>
><dtml-var "sequence-item-5"> does not work because it syubtracts item from
>sequence and five from item. Instead use:
>
><dtml-var "_['sequence-item']-5">

Is this refering to an earlier item in the sequence?

Is it the same as _.sequence-item-5 ?

Is there a declaration of _ anywhere that I can look at?

If I have a name clash (two Z SQL Method's return ID), how to I look up the
stack of namespaces?

Yours in abject confusion,
J. Cone