custom query in items browse action

Hi,

what i want to do is to cahnge the query in the browse items.
I have added a custom field in omeka_items table and I want to display only the items that have in this field the value "1".

Where I have to go to change the query and add "and field_name=1".

Thank you,
Stauros.

You'd have to use something like the items_browse_sql hook. See the documentation.

Can I have an example, because it is not so clear to me on how to use it. Is it something that I will add it in the Item controller?

Is there another way just to add it in the query of the browse items, maybe in the SearchItems.php to add a param in the function
function search($options = array())

It is a hook to implement in a plugin. Basically, it'll look something like in your plugin

protected $_hooks = array('items_browse_sql');

public function hookItemsBrowseSql($args)
{
    $select = $args['select'];
    $select->where("field_name = ?", 1);
}

I have create a page in applications/models/ with the name ItemsBrowseSql.php
and I insert the code that you send me

class ItemsBrowseSql extends Omeka_Plugin_Abstract
{
   protected $_hooks = array('items_browse_sql');

public function hookItemsBrowseSql($args)
{
    $select = $args['select'];
    $select->where("i.isTemplate = ?", 1);
}

}

it seems that something I am missing, what I am doing wrong?
If I click to echo the query I get :
SELECTi.* FROMomeka_itemsASiGROUP BYi.idORDER BYi.idDESC

It should be done as a plugin, not as an additional class in the core. The Coins plugin packaged with Omeka is a good model for how to start putting together a plugin.