[Zope-CMF] Re: How do I use effective and expiration date?

Carl Rendell cer@sol43.com
Mon, 4 Mar 2002 10:11:23 -0800


>
> Message: 4
> Date: Mon, 04 Mar 2002 00:04:14 -0600
> From: Mark Langkau <mark.langkau@pbmplus.com>
> To: zope-cmf@zope.org
> Subject: [Zope-CMF] How do I use effective and expiration date?
>
> Does anyone have examples of using the effective_date and
> expiration_date metadata items for filtering content? I'm using the
> default ZPT skins, Zope 2.4.3,  CMF 1.2, and Python 2.1.1 on Linux.
>
> For example, how would I "expire" a news item, yet allow it to still
> show up when a user clicks the "news" menu link? I'm learning to 
> use the
> zpt skins, but so far the skins are winning ;-)  I need to filter on
> dates, but I'm not sure how to do it with ZPT.
>
> I would like all "published"' news items to show up when I click the
> "news" link in the top menu bar. But any news item with a metadata
> Expiration Date older than "today" should not show up in the news_box,
> or recent_news. I still want to keep all entries as published news
> items, so I don't want to "retract" the news item.
>
> I would also like to use the effective_date to "pre-load" some news or
> other content, but not have it viewable until some future date.
>
> Unless I'm missing something (probably very simple ;-), this doesn't
> seem to be turned on out of the box.
>
> Thanks,
> Mark

I've run into this 'problem' when first using the CMF. The feature 
is turned on out of the box, but if you are logged in and have 
sufficient privilage to add and edit content, you'll see the 
content regardless of effectivity date.

It allows you to view the site 'as it will be' if you are editing. 
I use two browsers, one that i'm logged into for editing, and one 
that i'm not to see it as the user will see it.

If you want to control the view of effectivity controlled items 
when logged in. You can   set a publication rule on the 
portal_catalog search to be sure you only view published items - we 
currently do this -

<dtml-in "portal_catalog.searchResults( Type='News Item'
                                         , sort_on='Date'
                                         , sort_order='reverse'
                                         , review_state='published'
                                         , orphan=0
                                         )" size="4">

However, if you want to filter items that have not reached the 
effectivity date yet, or those that have 'expired' you'll need to 
filter those with a <dtml-if> at the dtml level for those that are 
logged in.

We do use effectivity a lot in our sites, and find it very effective.


Carl E. Rendell
Solution43
Information Distribution Consulting        |   "Ahhhh the power of
cer@sol43.com                              |    acquisition"  - Chef Z