<dtml-if related_stories> <table width=175 height=2 cellpadding=0 cellspacing=0 border=0> <tr><td> <font></font> </td></tr> </table> <table width=175 cellpadding=0 cellspacing=0 border=0 bgcolor="#e7e7e7"> <tr><td valign=top> <font size=2> <b>Related Stories</b><br> </font> <font size=2> <dtml-in related_stories> <dtml-let si=sequence-item rs_name_url="_.string.split( si, '^' )" rs_name="rs_name_url[0]" rs_url="rs_name_url[1]"> <li> <a href="http://<dtml-var rs_url>"><dtml-var rs_name></a></li> </dtml-let> </dtml-in> </font> </td></tr> </table> </dtml-if> gives me an error that says: "list index out of range" The related_stories property contains: King Kong website^www.kong.com Empire State Building Website^www.empirestate.com It worked at first but when I made any changes to other properties it gave me that error message. Any ideas? Tom Scheidt | www.falsemirror.com | tom@falsemirror.com ---------------------------------------------------------------------------- -----------
A traceback is always helpful and would have been useful. Is it possible that there is a 3rd, empty item, or an item with no ^, in "related_stories"? An empty item when split would return only 1 subitem and your code is assuming you will always have two. A test for the ^ in the item before splitting would prevent this. Try this: ... <dtml-if "_.string.find(['sequence-item'],'^')!=-1"> <dtml-let si=sequence-item rs_name_url="_.string.split( si, '^' )" rs_name="rs_name_url[0]" rs_url="rs_name_url[1]"> <li> <a href="http://<dtml-var rs_url>"><dtml-var rs_name></a></li> </dtml-let> </dtml-if> ... Jim Sanford ----- Original Message ----- From: "Tom Scheidt" <tom@falsemirror.com> To: <zope@zope.org> Sent: Monday, May 22, 2000 3:58 PM Subject: [Zope] dtml-in Tag problem <dtml-if related_stories> <table width=175 height=2 cellpadding=0 cellspacing=0 border=0> <tr><td> <font></font> </td></tr> </table> <table width=175 cellpadding=0 cellspacing=0 border=0 bgcolor="#e7e7e7"> <tr><td valign=top> <font size=2> <b>Related Stories</b><br> </font> <font size=2> <dtml-in related_stories> <dtml-let si=sequence-item rs_name_url="_.string.split( si, '^' )" rs_name="rs_name_url[0]" rs_url="rs_name_url[1]"> <li> <a href="http://<dtml-var rs_url>"><dtml-var rs_name></a></li> </dtml-let> </dtml-in> </font> </td></tr> </table> </dtml-if> gives me an error that says: "list index out of range" The related_stories property contains: King Kong website^www.kong.com Empire State Building Website^www.empirestate.com It worked at first but when I made any changes to other properties it gave me that error message. Any ideas? Tom Scheidt | www.falsemirror.com | tom@falsemirror.com ---------------------------------------------------------------------------- ----------- _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Jim Sanford -
Tom Scheidt