Displaying SQL results correctly
Hi I'm extracting content from a database which contains several numbers for example 72, 354. Each number is separated by commas. The numbers correspond to other id's within the table. I'm using below which kind of works however the url is specified as http://157.228.32.93:9191/education/nug_db/detail_html?id=72,%20354 and i'm using below to get the results CourseLike is the field which corrospond to other ID's - 72, 354 CourseTitle is the course title <a href="" tal:define="CourseLike result/CourseLike" tal:attributes="href string:detail_html?id=$CourseLike" tal:content="result/CourseTitle" target="_blank"> <span tal:replace="result/CourseTitle">CourseTitle goes here</span></a> i'd like each id to be repeated separately rather than in the one long url. Any help appreciated. Thanks very much dean --------------- Dean Hale Web Development Manager Information Services University of Sunderland w: http://www.library.sunderland.ac.uk t: +44 (0) 191 515 2424 f: +44 (0) 191 515 2904
Dean Hale wrote at 2004-11-25 11:13 +0000:
I'm extracting content from a database which contains several numbers for example 72, 354. Each number is separated by commas. The numbers correspond to other id's within the table.
I'm using below which kind of works however the url is specified as
http://157.228.32.93:9191/education/nug_db/detail_html?id=72,%20354
Note that the use of "%20" (this is a blank) is forbidden in query strings. In query strings, blank must be coded as "+".
... CourseLike is the field which corrospond to other ID's - 72, 354 CourseTitle is the course title
<a href="" tal:define="CourseLike result/CourseLike" tal:attributes="href string:detail_html?id=$CourseLike" tal:content="result/CourseTitle" target="_blank"> <span tal:replace="result/CourseTitle">CourseTitle goes here</span></a>
i'd like each id to be repeated separately rather than in the one long url.
I have problems to understand what you want... When you repeat the ids separately, the URL will become longer... Repeating separately would look like: tal:define=" ... ids result/CourseLike; repeatedIds python:'&'.join(['id:list=%s' % id for id in ids]); ... " >... tal:attributes="href string:detail_html?$ids" The code above assumes that "result/CourseLike" returns a sequence of ids. If instead it returns a string, it will need to be split at its element separator (apparently ", ") to obtain a list of ids. -- Dieter
participants (2)
-
Dean Hale -
Dieter Maurer