featured collection/ exhibit

why is that i do not see an image thumbnail on my 'featured collection' section on the home page.

also i do not see 'featured exhibit' at all, thought i have chosen some exhibits to be featured.

any help be deeply appreciated.

Hi pilgrimhawk:

You do not see an image thumbnail for 'featured collection' because collections do not have files associated with them. You could modify the theme to show a thumbnail from an item in a featured collection if you'd like. I can provide that code if that's what you'd like to do.

You likely do not see a 'featured exhibit' on your home page because you'll need to add <?php echo exhibit_builder_display_random_featured_exhibit(); ?> on your index.php file, where you want the random featured exhibit to display. Try adding that and see if a random exhibit shows up on your home page.

Hope this helps!
Jeremy

thanks jermy, would be a great help if you could get me the code you specified... and how do i feature the omeka archive i built on the official omeka 'showcase' page.

hi jermy, still waiting for the promised code...am sure it will help many.

Sorry for the delay. Getting a random item that's part of a collection turned out to be a bit more complicated than I anticipated. But, here's some code that you can

First, you need a function to just get a random item with an image. I've called this function find_random_item, and detail it below:

<?php
function find_random_item($params = array())
{
    $db = get_db();
    $table = $db->getTable('Item');

    $select = new Omeka_Db_Select;
    $select->from(array('i'=>$db->Item), array('i.*'));
    $select->from(array(), 'RAND() as rand');
    $select->order('rand DESC');

    if ($params['withImage']) {
        $select->joinLeft(array('f'=>"$db->File"), 'f.item_id = i.id', array());
        $select->where('f.has_derivative_image = 1');
    }

    $table->applySearchFilters($select, $params);

    $select->limit(1);

    $item = $table->fetchObject($select);

    return $item;
}

?>

Put this function in your custom.php file in your active theme. If you don't have this file, just make a blank one.

Now we'll use a second custom function to display a random featured collection with a random item from that collection (that also has an image). I've called this function display_random_featured_collection_with_item, and detail it below:

<?php
function display_random_featured_collection_with_item()
{

    $featuredCollection = random_featured_collection();
    $html = '<h2>Featured Collection</h2>';
    if ($featuredCollection) {

        $item = find_random_item(array('withImage' => true, 'collection' => $featuredCollection->id));

        $html .= '<h3>' . link_to_collection($collectionTitle, array(), 'show', $featuredCollection) . '</h3>';
        if (item_has_thumbnail($item)) {
            $html .= link_to_item(item_square_thumbnail(array(), 0, $item), array('class'=>'image'), 'show', $item);
        }
        if ($collectionDescription = collection('Description', array('snippet'=>150), $featuredCollection)) {
            $html .= '<p class="collection-description">' . $collectionDescription . '</p>';
        }
    } else {
        $html .= '<p>No featured collections are available.</p>';
    }
    return $html;
}
?>

Add this function to your custom.php file along with the find_random_item() function. Then use

<?php echo display_random_featured_collection_with_item(); ?>

on your homepage, and you should get a random featured collection with an image item.

Let me know if this helps,
Jeremy

thanks for the effor jermey, but it did not work..in fact there is no visible difference even after i modified the 2 php files...

jermy, an update...when i tried now it showed a random featured item...but not in the specified space...the random item was displayed in the left bottom corner - out of the main data display area.

jermy..hey..it worked..thanks a lot...and this happens to be the first omeka based archive from india:

http://173.203.201.26/birdseyeview/

Hi, glad you got it working!