Reverse Item List

This is not a big deal, I'm just curious if it's possible. When visiting the Items page, the most recently added items are listed first. I'm curious if this can be easily reversed and if it's a theme issue (e.g., in the items/browse.php of the themes directory) or if its a change in one of the admin subdirectories.

Thanks.

Hi Sean,

There's no setting in the system currently that allows you to reverse the order of items. But, you can hack the public theme to do this.

If you want the items to display in reverse order, you'll need to use a PHP function called array_reverse() to reverse the array of items fed to the items/browse.php file. So, right above where you see:

<?php foreach($items as $item): ?>

You need to add:

<?php $items = array_reverse($items); ?>

So, the final change should look like this:

<?php foreach($items as $item): ?>
<?php $items = array_reverse($items); ?>

This essentially redefines the $items array on that page to display in reverse order.

array_reverse() is documented at PHP.net.

Thanks Jeremy for the tip and the link to the documentation. That definitely works for each page. Do you think there is a way to do this globally, for all the items, rather than page by page? For example, if I have a 1000 items in my collection and I began adding them with item #1 and ended with item #1000, currently item #1000 is listed first. I was wondering if it's possible to begin with #1 and proceed page by page to item #1000. So the first page would be numbers 1 - 10 and the last page would be numbers 991 - 1000. Our collection is chronological so it would be cool if items were listed beginning with the first year of our collection. I'm not sure if that kind of control is possible, but I'm curious if I can reverse the array globally rather than within a single page.

On the other hand, users will be able to access our collections in chronological order in the collections page, but I'm just curious if it's possible from the items page.

Hi, actually there is a way to do this. If you put ?recent=false in the query string, so your URL to browse items looks like items/browse?recent=false, it should show the items in the default order.

Kris, that worked wonderfully. Thanks for the tip!

Hi, how could I best set the number of recent items to zero? i.e. not have that heading show up at all.

Ok, to answer my own question in case another newbie is interested in this too: I managed this by commenting out the div listing "recent-items" in /application/views/scripts/index.php More info on the recent items function here: http://omeka.org/codex/Functions/recent_items

Thanks for posting your solution for others.

Note that it's generally not a good idea to modify the files in application/views/scripts, since Omeka updates will replace those files.

It's usually a better idea to copy that file into a theme of your own and edit it there.