pythonplonezopetal

How to access an array with TAL


I have a python file which creates an array with a path to an image and a page URL

self.banner1 = [self.context.defaultBanner1.filename,self.context.defaultBanner1bUrl]

I want to access this within my page using TAL. I have tried this without success

<h1 tal:content="view/banner1[0]"></h1>

How do I access the array using TAL?


Solution

  • You can't do that with a path expression, but you can use a Python expression:

    <h1 tal:content="python:view.banner1[0]" />