[Zope] ZPT: looping through a list of attributes

Joel Burton joel@joelburton.com
Thu, 21 Feb 2002 02:29:56 -0500 (EST)


On Thu, 21 Feb 2002, Chad Nantais wrote:

<meta name="keywords"
      contents="will, appear, here"
      tal:attributes="content python:string.join(a,',')">

(might need to help TAL find the string module; I don't remember.)

> 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;">

 ...

>
> 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?

-- 

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant