get_items function

Hi,

I am experience very inconsistence behaviour with the way get_items function run.

I use this function and pass an exhibit id to it to get the first image from first item in the exhibit.

I run this function couple of weeks a go and it was perfectly do the job. Then I moved the db to another server and still all exhibits created are displayed with first image in first item in the exhibit.

However, I am experience this since last week. Every time I add a new exhibit and created pages to new exhibit and add items to these pages, I get the last item and not the first item.

If I go back to the old exhibits created and add a new page then add an item to this page, I still
get the first item from the page and not the last item that I just created.

I already released the code and we will start use it next week but I was wonder if there is a nother way I can get the first item only from an exhibit because get_items behave in consistent.

It is very important for us to keep the image used with exhibit the same all the time.

I looked at the db. I do need to join exhibit, items, section, section_pages tables to get to the first item. is there a better way?

function already done that I can use?

please help if you know another solution.
thanks

My guess is that things appear to work differently because you haven't specified how to sort the records. If you add sort_field and sort_dir keys to the array you pass to get_items, you might be able to order the results to zero in on the item you want.

Note that this will sort by a property of the _item_ (for example, when it was created). This won't let you sort by when the page was added to the exhibit.

So I want to sort by the order column in the omeka_items_section_pages

there is a colum name 'order' which set the order of items when loaded to the page.

Can I sort by order?

Need the first item loaded in the page?
Thanks

if not, is there another way to get the first item loaded to the first page in an exhibit?

You could always drill down from the Exhibit to the first section, etc. The methods are pretty straightforward when you look at the model classes, such as Exhibit->getFirstSection(), ExhibitSection->getPageByOrder($order), etc. That might be the most reliable approach for your needs.