[Zope] zpt wackyness

Russell Uman russ@viz.com
Tue, 30 Apr 2002 13:06:12 -0700


i have a main page template: index_html
i have a number of content templates that i would like to include into my main page. the title property is set for each object:
content_1, title = "number one"
content_2, title = "number two"
content_3, title = "number three"

i'm trying to dynamically choose which content object to display based on a request variable.

here is what i have in index_html:

<HTML tal:define="page request/page | string:content_1">
<span tal:replace="python:container[page].title">title</span>
<span tal:replace="structure python:container[page]">body</span>

this is what i see if i browse to index_html?page=content_2

number one
<ZopePageTemplate instance at 8960bf0>

so the title is working! but the body is not.
how can i get zope to include the contents of the object? is there a better way to translate a string into an object? if i make a
call to tal:replace="container/content_1" i have no problems - i just can't figure out how to do this dynamically...

thanks!