[Zope] ZPT: looping through a list of attributes

Chad Nantais cnantais@rednaxel.com
Thu, 21 Feb 2002 01:48:28 -0500


I need insert keywords into the meta keywords part of a web page,
dynamically, using page templates. The list of keywords is pulled from a
list of subjects like this: ('foo','bar','foobar')
The list is actually the subject element from the Dublin Core metadata in
CMF content.

The code I am using currently is:

<meta name="keywords"
      content="Keywords, will, appear, here"
      tal:repeat="item here/subject"
      tal:attributes="content repeat/item">


That code results in (from a list of 5 subjects):

<meta name="keywords"
      content="&lt;Products.PageTemplates.TALES.Iterator instance at
023755CC&gt;">
<meta name="keywords"
      content="&lt;Products.PageTemplates.TALES.Iterator instance at
023755CC&gt;">
<meta name="keywords"
      content="&lt;Products.PageTemplates.TALES.Iterator instance at
023755CC&gt;">
<meta name="keywords"
      content="&lt;Products.PageTemplates.TALES.Iterator instance at
023755CC&gt;">
<meta name="keywords"
      content="&lt;Products.PageTemplates.TALES.Iterator instance at
023755CC&gt;">

How do I get TAL to list one keyword after another in the quotes rather than
creating a new tag on each iteration? Also, how do I convert them to
strings, rather than the object instances they are now?

Thanks