On Tue, May 31, 2005 at 07:17:46PM +0300, Vital Lobachevsky wrote: > John Poltorak wrote: > > On Tue, May 31, 2005 at 06:23:11PM +0300, Vital Lobachevsky wrote: > > > >>John Poltorak wrote: > >> > >>>I want to provide a set of links on a Zope site dynamically. ie don't want > >>>to hard code a number of links, but would like to load them from an > >>>external source which I can add to independently, but I have no idea as to > >>>how to set about it. > >>> > >>>Any ideas?
> Well, it's really easy. Create 'linkList' (Python Script) in the folder > where you page lives or somewhere higher in folder hierarchy: > > ## Script (Python) "linkList" > return [ > ('http://www.google.com/', 'Google'), > ('http://www.yahoo.com/', 'Yahoo'), > ] > > If your page is Page Template, it maybe something like this > > <html> > <body> > <h1>Search Engines</h1> > <tal:block repeat="item here/linkList"> > <a tal:content="python:item[1]" > tal:attributes="href python:item[0]"></a><br /> > </tal:block> > </body> > </html> > > If you page is DTML Method, you can do the same using <dtml-in> tag. > How would I extend this so that the Python script could read data from an independently maintained text file which could uploaded periodically? ie using a file containing something like:- http://www.google.com/,Google http://www.yahoo.com/,Yahoo -- John _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )