[Zope] Last modified - including contents?
Dieter Maurer
dieter@handshake.de
Thu, 21 Sep 2000 00:43:07 +0200 (CEST)
Marcin Kasperski writes:
> Two questions related to presenting 'last modified at ...' message on
> HTML page.
>
> 1) I have some pages (for instance my website news page or some indexes)
> which are dynamically build from another pages (usually via dtml-in -
> reading elements of some type from some folder). Does there exist any
> easy way to present the _newest_ bobobase_modification_time for all used
> elements? Currently on my news page I show 'last modified at 2000/08/14'
> although in fact this page has been modified at '2000/09/16'...
"bobobase_modification_time" is a "DateTime.DateTime" object.
You can compare such objects and compute the maximal value
as you process the page components, something like:
<dtml-call "REQUEST.set('maxdate',this().bobobase_modification_time)">
<!-- ATTENTION: will work only for DTML documents, not
for methods -->
<dtml-in ...>
<dtml-if "maxdate < bobobase_modification_time">
<dtml-call "REQUEST.set('maxdate',bobobase_modification_time)">
</dtml-if>
.....
</dtml-in>
<dtml-var maxdate> <!-- the maximal date -->
> 2) Similar question related to marking website parts as 'New' or
> 'Recently changed' in different indexes. What is the easiest way to
> calculate date of the newest change in the whole folder hierarchy
> starting from the given folder?
You first enumerate all objects with "ZopeFind" (documented, e.g.,
in the Zope object reference --> zdp.zope.org) and then compute
the maximum as shown above.
Dieter