Hey everyone, I was looking at linux.com the today and I noticed their "Daily Photo." I occurred to me that that would be a fun addition to the school's page that I'm developing. My first thought would be to: * inherit from Image * add caption, date taken, etc. properties * create an archive of past photos What I'm not sure about is how to have Zope automatically display the photo for a day, then archive it. Would a boolean property of the ZClass work? Is it possible to have Zope set the property of a ZClass instance at certain time? Any thoughts on how this would be designed? -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.k12.mn.us/ | http://www.zope.org/ W. St. Paul, MN | | http://slashdot.org/ wilson@visi.com | <dtml-var pithy_quote> | http://linux.com/
// What I'm not sure about is how to have Zope automatically // display the photo // for a day, then archive it. Would a boolean property of the // ZClass work? Is // it possible to have Zope set the property of a ZClass instance // at certain // time? Any thoughts on how this would be designed? Hi Tim, Here's some code I use with a simple NewsItem ZClass that only displays objects that have not yet "Expired". With a little modification, it could be used to test a "DisplayDate" value and if it matches the current date, the photo would be displayed. That way you could load a bunch of photos into your site at once and give them specific display dates. If more than one had the same date, they would both be shown. "Expires" is a property of my NewsItem ZClass that is of type "date". "Expires+1" just adds a day to the expiration date so that my news items are displayed up to, and including, their expiration date. The NewsItem ZClass has a meta type of "News Item," which is used in the "in" statement. "view" is a method of the ZClass that simply formats the NewsItem for displaying in the browser. <dtml-with News> <dtml-in expr="objectValues('News Item')" sort=id reverse> <dtml-if "ZopeTime().lessThanEqualTo((Expires+1))"><dtml-var view><br></dtml-if> </dtml-in> </dtml-with> Hope it helps... Eric.
On Wed, Jan 17, 2001 at 12:20:06PM -0600, Timothy Wilson wrote:
Hey everyone,
I was looking at linux.com the today and I noticed their "Daily Photo." I occurred to me that that would be a fun addition to the school's page that I'm developing. My first thought would be to:
* inherit from Image * add caption, date taken, etc. properties * create an archive of past photos
What I'm not sure about is how to have Zope automatically display the photo for a day, then archive it. Would a boolean property of the ZClass work? Is it possible to have Zope set the property of a ZClass instance at certain time? Any thoughts on how this would be designed?
I'd pre-create the archive in advance. Use dates as Ids, and have the archive page only list past photos. The homepage would show the photo for today. Simple and sweet. Or you could use a Python Script/Python Method/External Method/DTML Method (whatever you prefer) called currentPhoto or something that does the calculation for you and return the correct object to the caller. -- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ ---------------------------------------------
participants (3)
-
Eric Walstad -
Martijn Pieters -
Timothy Wilson