Link to collections on item/show

I need a bit of help thinking this through..

I am using Simple Pages where I have images that link to the Collection/Browse page to see all items in that collection and that works great.
The problem is the link under "Collections" on the item/show page that is supposed to take you back to that collection's browse items page. All collections are public, but I get this error on the public view:

Omeka has encountered an error

Omeka_View_Exception
A current item variable has not been set to this view.

#0 [internal function]: Omeka_View_Helper_GetCurrentRecord->getCurrentRecord('item')
#1 /home/themari0/library/application/libraries/Zend/View/Abstract.php(350): call_user_func_array(Array, Array)
#2 /home/themari0/library/application/views/helpers/Metadata.php(53): Zend_View_Abstract->__call('getCurrentRecor...', Array)
#3 /home/themari0/library/application/views/helpers/Metadata.php(53): Omeka_View->getCurrentRecord('item')
#4 [internal function]: Omeka_View_Helper_Metadata->metadata('item', Array, Array)
#5 /home/themari0/library/application/libraries/Zend/View/Abstract.php(350): call_user_func_array(Array, Array)
#6 /home/themari0/library/application/libraries/globals.php(1981): Zend_View_Abstract->__call('metadata', Array)
#7 /home/themari0/library/application/libraries/globals.php(1981): Omeka_View->metadata('item', Array, Array)
#8 /home/themari0/library/themes/seasons/common/record-metadata.php(1): metadata('item', Array)
#9 /home/themari0/library/application/libraries/Omeka/View.php(117): include('/home/themari0/...')
#10 /home/themari0/library/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run('/home/themari0/...')
#11 /home/themari0/library/application/libraries/Zend/View/Helper/Partial.php(109): Zend_View_Abstract->render('common/record-m...')
#12 [internal function]: Zend_View_Helper_Partial->partial('common/record-m...', Array)
#13 /home/themari0/library/application/libraries/Zend/View/Abstract.php(350): call_user_func_array(Array, Array)
#14 /home/themari0/library/application/views/helpers/AllElementTexts.php(305): Zend_View_Abstract->__call('partial', Array)
#15 /home/themari0/library/application/views/helpers/AllElementTexts.php(305): Omeka_View->partial('common/record-m...', Array)
#16 /home/themari0/library/application/views/helpers/AllElementTexts.php(255): Omeka_View_Helper_AllElementTexts->_loadViewPartial(Array)
#17 /home/themari0/library/application/views/helpers/AllElementTexts.php(289): Omeka_View_Helper_AllElementTexts->_getOutputAsHtml()
#18 /home/themari0/library/application/views/helpers/AllElementTexts.php(88): Omeka_View_Helper_AllElementTexts->_getOutput()
#19 [internal function]: Omeka_View_Helper_AllElementTexts->allElementTexts('collection', Array)
#20 /home/themari0/library/application/libraries/Zend/View/Abstract.php(350): call_user_func_array(Array, Array)
#21 /home/themari0/library/application/libraries/globals.php(1996): Zend_View_Abstract->__call('allElementTexts', Array)
#22 /home/themari0/library/application/libraries/globals.php(1996): Omeka_View->allElementTexts('collection', Array)
#23 /home/themari0/library/application/views/scripts/collections/show.php(12): all_element_texts('collection')
#24 /home/themari0/library/application/libraries/Omeka/View.php(117): include('/home/themari0/...')
#25 /home/themari0/library/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run('/home/themari0/...')
#26 /home/themari0/library/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(900): Zend_View_Abstract->render('collections/sho...')
#27 /home/themari0/library/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(921): Zend_Controller_Action_Helper_ViewRenderer->renderScript('collections/sho...', NULL)
#28 /home/themari0/library/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(960): Zend_Controller_Action_Helper_ViewRenderer->render()
#29 /home/themari0/library/application/libraries/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#30 /home/themari0/library/application/libraries/Zend/Controller/Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#31 /home/themari0/library/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('showAction')
#32 /home/themari0/library/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#33 /home/themari0/library/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#34 /home/themari0/library/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#35 /home/themari0/library/application/libraries/Omeka/Application.php(79): Zend_Application->run()
#36 /home/themari0/library/index.php(23): Omeka_Application->run()
#37 {main}

Just so I understand right, the error happens on items/show pages, not on your simple page? From the error, I'd have expected it to be on the simple page.

It looks like you've edited your common/record-metadata.php file to have a specific reference to Items in it.

That file is used for more than just Items, and isn't designed to rely on the "current record" in the way that a call to metadata('item', ...) does.

The error displays when I click on the collection name from my public items/show page.

Also, I had edited my record-metadata.php file in order to re-label the Dublin Core fields. Would I be doing something wrong here? For each DC field, I have something like this:

<div><?php $var_Description = metadata('item', array('Dublin Core', 'Description'));
if (empty($var_Description)): ?>
<?php else: ?>
<div class="element">
<h3><u>
Text on Item</u>
</h3>
<div class="element-text">
<?php echo $var_Description; ?>
</div>
</div>
<?php endif; ?>

Yes, that's a problem.

You want something like this (working from the original code):

<?php foreach ($elementsForDisplay as $setName => $setElements): ?>
<div class="element-set">
    <h2><?php echo html_escape(__($setName)); ?></h2>
    <?php foreach ($setElements as $elementName => $elementInfo): ?>
    <div id="<?php echo text_to_id(html_escape("$setName $elementName")); ?>" class="element">
        /* changes begin here */
        <?php
        $customName = null;
        if ($setName == 'Dublin Core'):
            if ($elementName == 'Description'):
                $customName = 'Text on Item';
            elseif ($elementName == 'Title'):
                $customName = 'Some Custom Title';
            // ...
            endif;
        endif;
        ?>
        <?php if ($customName): ?>
            <h3><?php echo $customName; ?></h3>
        <?php else: ?>
            <h3><?php echo html_escape(__($elementName)); ?></h3>
        <?php endif; ?>
        /* changes end here */
        <?php foreach ($elementInfo['texts'] as $text): ?>
            <div class="element-text"><?php echo $text; ?></div>
        <?php endforeach; ?>
    </div><!-- end element -->
    <?php endforeach; ?>
</div><!-- end element-set -->
<?php endforeach;

If you have a large number of customizations you could store them in an array and look them up rather than tediously writing a bunch of if and elseif statements.

The bottom line: you already are being given the set of metadata fields that's being printed when you're in record-metadata.php. You should never be calling metadata from within that file.

Wonderful!

Thank you for your help and for clarifying what I was missing on the records-metadata.php page. The Collection link works exactly as it should now. Thank very much!