Limit recent portlet entries

This is a very short modification to the portlet_recent.pt template in order to limit the number of displayed entries from 5 to 3.

The original template:

...
<tal:recentlist tal:define="view context/@@recent_view;
results view/results;">
<dl class="portlet" id="portlet-recent">

<dt class="portletHeader">
<span class="portletTopLeft"></span>
<a href="http://www.len.ro/work/cms/limit-recent-portlet-entries"
tal:attributes="href string:${portal_url}/recently_modified"
i18n:translate="box_recent_changes">Recent Changes</a>
<span class="portletTopRight"></span>
</dt>
<tal:items tal:repeat="obj results">
<dd class="portletItem"
...

The modified template:

...
<tal:recentlist tal:define="view context/@@recent_view;
results view/results;
subresults python:results[:3]">
<dl class="portlet" id="portlet-recent">

<dt class="portletHeader">
<span class="portletTopLeft"></span>
<a href="http://www.len.ro/work/cms/limit-recent-portlet-entries"
tal:attributes="href string:${portal_url}/recently_modified"
i18n:translate="box_recent_changes">Recent Changes</a>
<span class="portletTopRight"></span>
</dt>
<tal:items tal:repeat="obj subresults">
<dd class="portletItem"
...

Notice the definition of the subresults = results[:3].

Leave a Reply

*