[Zope] TAL/SQL Problem
Philip Beardmore
philip.beardmore at sunderland.ac.uk
Thu Apr 7 13:10:31 EDT 2005
Thanks to both Barry and Madhavi for the solution. Works great guys!
Ta
----- Original Message -----
From: Barry Pederson <bp at barryp.org>
Date: Thursday, April 7, 2005 4:38 pm
Subject: Re: [Zope] TAL/SQL Problem
> 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>> tal:attributes="href string:detail_html?id=$id"
> > tal:content="result/interests"
> >>Interests goes here</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