John Poltorak wrote:
Several months ago someone provided me with me with some sample code which did exactly what I wanted, but looking at it again it looks a little unwieldy and could do with tidying up. It consists of:-
<span tal:define="opts python:here.lib.parse_file(file=here.news,sepr=',',clone=1)"> <tal:block repeat="opt opts"> <li><a tal:content="python:opt[1]" tal:attributes="href python:'news_items/' + opt[0]"></a></li> </tal:block> </span>
Okay, if you can get parse_file to return a list of dictionaries like: [ { 'folder':'whatever', 'label':'whatever', } ] ...then you can do: <span tal:define="opts python:here.lib.parse_file(file=here.news,sepr=',',clone=1)"> <li repeat="opt opts"> <a tal:content="python:opt/label" tal:attributes="href string:news_items/${opt/folder}"/> </li> </span> cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk