In the freearch theme they do this:
def recently_published_news(self):
context = self.context
catalog = getToolByName(context, 'portal_catalog')
results = []
for r in catalog(portal_type='News Item',
review_state='published',
sort_on='Date',
sort_order='reverse',
sort_limit=2,):
results.append(dict(date=r.Date,
year=DateTime(r.Date).year(),
month=DateTime(r.Date).month(),
day=DateTime(r.Date).day(),
news_obj=r.getObject(),
url=r.getURL(),
title=r.Title,
description=r.Description,
))
return results
Hope that helps.
Sanders wrote:
I created a site for moaweb.nl in Plone 3 with a custom homepage.
It's based on 4 columns where the client can maintain the content completely TTW.
In the custom template I created the following code for the events:
<ul>
{% for n in evenementen %}
<li>
{{n.titel|safe}}</li>
{% endfor %}
</ul>
Overzicht evenementen »How can I adjust this code so that:
- only the X most recent items in folder X are shown?
I tried different pieces of python code but only ended up with no content shown at all.
My understandig of this language is very limited and I'm definetly stuck here.
Maybe someone can give me a push in the right direction?
Greetings,
Nique