[Zope] TAL/SQL Problem

Barry Pederson bp at barryp.org
Thu Apr 7 11:38:12 EDT 2005


Phil Beardmore wrote:
> Hi, hope you can help.
> 
> We are currently linking a webpage to an SQL database and are pulling in
> information via the tal:replace function.  This is working extremely
> well however one of our SQL fields is comma deliminated, and we want it
> to appear as a list.  We have accomplished this by using the following
> code:
> 
> <h1>Interests</h1>
> 
> <tal:x define="test2 result/interests"
>       repeat="id python:interests.split(',')">
>  <p><a href=""
>     tal:attributes="href string:detail_html?id=$id"
>     tal:content="result/interests"
>>Interests goes here</a></p>
> </tal:x>
> 
> This works well, and each item of text is displayed as a list item. 
> Only problem we have, is we want to be able to display the SQL text as
> the link name, but instead each link has the same link text which is the
> whole of the SQL string.
> 
> E.g.  The text in the interests field is:  Swimming,Badminton,Ice Hockey
> <detail_html?id=Swimming>
> 
> The code seperates the text via the comma, and displays a list item for
> each activity.  Only problem is, the link text for each activity is the
> same (Swimming,Badminton,Ice Hockey <detail_html?id=Swimming>).  Anyone
> got any ideas?
> 
> Hope you can understand what I am after.  An example page is at:
> 
> http://lash.sunderland.ac.uk/business/organisationandstaff/test/detail_html?id=10
> 
> 
> Thanks
> Phil

In the <a> tag, instead of

     tal:content="result/interests"

shouldn't it be

     tal:content="id"

-------

	Barry


More information about the Zope mailing list