Thanks to both Paul and AJ -- both suggestions were helpful. The extended
description Paul gave me below was particularly use.
Here's what I learned:
1) the form object is automagically handed to the template when you do a
2) I assumed that I would have to pass the form object to the template --
but this is not needed. More usefull is that when 'item' is given to the
template as parameter, shown above, that the template gets a NEW? namespace
called 'options'. I think this is new to me.
3) then, within the template the tales expression options/item gives me
This really helps me understand better how script and templates work
together. A year from now, I'll need to relearn this again and may google my
Thanks to all on the plone list.
On 9/10/08, Paul Winkler <[EMAIL PROTECTED]> wrote:
> On Wed, Sep 10, 2008 at 07:57:29PM -0700, David Bear wrote:
> > I have a script that calls a template.
> > The template has a tal expressions like this
> > <p tal:content="structure here/ploneDoc/getText"> </p>
> > I want my script to call the template in such a way that the string
> > 'ploneDoc' is replaced by a different string.
> > I'm not sure how to go about parameterizing a tales expressions like
> > this.
> It is possible, by sticking a question mark in front of ploneDoc; but
> afaict you can only use a variable already in the namespace,
> i.e. you'd have to define it first. Like so:
> <p tal:define="docname options/ploneDoc"
> tal:content="structure here/?docname/getText"> </p>
> But I have literally never seen this obscure feature in real use,
> because nobody seems to know about it (I had forgotten it myself), and
> because it's not necessary. I'd prefer to have the script just pass in
> the object you want, as per this document:
> So, in your script, something like:
> doc = context.restrictedTraverse(some_path)
> return context.mytemplate(mydoc=doc)
> Then, in your template just do:
> <p tal:content="structure options/mydoc/getText"></p>
> Paul Winkler
> Zope maillist - Zope@zope.org
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-dev )
College of Public Programs at ASU
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -