I am having trouble modifying the contents of the Citation box on individual items at (https://omeka.millikensbend.com) . I don’t know coding. I have tried to follow the instructions on this post: (Editing citations on omeka - #3 by ebellempire) with no success.
I’m wanting to do something similar. I want to include the Source and Contributor fields as part of the Citation, so that both the Omeka site and the original source information is included in the Citation that displays at right on the Item page.
I am using Omeka Classic ver. 3.1.2, Seasons theme.
I think the problem must be that my file structure is different than that used in the posted example with code, so I can’t figure out exactly which file, where, needs to be modified.
When I try to follow the above post’s instructions which tell me to add info to my theme’s custom.php file – well, there is no custom.php in the Omeka>>Themes>>Seasons folder. However, there is a custom.php within the Omeka>>Themes>>Default folder.
Similarly, the above post tells me to put a line into my Themes Items browse.php file. But there is no browse.php within my Omeka>>Themes>>Seasons>>Items folder nor is there a browse.php within the Omeka>>Themes>>Default>>Items folder.
I’m at a loss as to how to make the desired modifications to the Citation that is displayed in the box to the right on each item.
If a particular theme file doesn’t exist in a given theme directory, then the theme is using the default file from Omeka core. Those files can be found in /application/views/scripts/
and you should copy (not move) them to your theme directory before making modifications.
https://omeka.readthedocs.io/en/latest/Tutorials/modifyingThemes.html
Hmm. Well, I tried what you suggested - but after copying, then modifying, the custom.php and browse.php inside of Seasons theme folder (browse.php inside of Seasons/Items), my entire Omeka site goes blank. Just a plain white screen.
I wasn’t certain where in all of the info contained in the browse.php that I was supposed to put the line:
my_custom_citation($item);
so perhaps that’s where the problem is.
Do you have an error message you can share?
https://omeka.org/classic/docs/Troubleshooting/Retrieving_Error_Messages/
Just a note here: copying files from the core application/views/scripts folder is the right move for making changes to theme files your theme doesn’t have (like items/browse.php), but I wouldn’t extend that to the custom.php file.
If you want/need to add something to custom.php and your theme doesn’t have one, just start with a blank file (put <?php
on the first line), don’t copy the core’s custom.php.
I’m omitting top-level directory details for security purposes, but:
PHP Warning: require_once(/…/…/omeka.millikensbend.com/themes/seasons/functions.php): Failed to open stream: No such file or directory in /…/…/omeka.millikensbend.com/themes/seasons/custom.php on line 2
PHP Fatal error: Uncaught Error: Failed opening required ‘/…/…/omeka.millikensbend.com/themes/seasons/functions.php’ (include_path=‘/…/…/omeka.millikensbend.com/application/libraries:/…/…/omeka.millikensbend.com/application/models:.:/opt/cpanel/ea-php82/root/usr/share/pear’) in /…/…/omeka.millikensbend.com/themes/seasons/custom.php:2
Stack trace:
#0 /…/…/omeka.millikensbend.com/application/libraries/Omeka/View.php(141): include()
#1 /…/…/omeka.millikensbend.com/application/libraries/Omeka/View.php(111): Omeka_View->_loadCustomThemeScripts()
#2 /…/…/omeka.millikensbend.com/application/libraries/Zend/View/Abstract.php(889): Omeka_View->_run(‘/home1/lindabar…’)
#3 /…/…/omeka.millikensbend.com/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(912): Zend_View_Abstract->render(NULL)
#4 /…/…/omeka.millikensbend.com/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript(‘error/404.php’, NULL)
#5 /…/…/omeka.millikensbend.com/application/libraries/Zend/Controller/Action.php(212): Zend_Controller_Action_Helper_ViewRenderer->render(‘404’, NULL, false)
#6 /…/…/omeka.millikensbend.com/application/controllers/ErrorController.php(67): Zend_Controller_Action->render(‘404’)
#7 /…/…/omeka.millikensbend.com/application/libraries/Zend/Controller/Action.php(516): ErrorController->notFoundAction()
#8 /…/…/omeka.millikensbend.com/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch(‘notFoundAction’)
#9 /…/…/omeka.millikensbend.com/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#10 /…/…/omeka.millikensbend.com/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(106): Zend_Controller_Front->dispatch()
#11 /…/…/omeka.millikensbend.com/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#12 /…/…/omeka.millikensbend.com/application/libraries/Omeka/Application.php(73): Zend_Application->run()
#13 /…/…/omeka.millikensbend.com/index.php(23): Omeka_Application->run()
#14 {main}
thrown in /…/…/omeka.millikensbend.com/themes/seasons/custom.php on line 2
I’m actually wondering if maybe the problem could be in show.php.
When I look at the Page Source in my browser for any certain item-page, (such as: Detail of Map of Plantations in Carroll Parish...and Issaquena County...ca. 1863 · Milliken's Bend Virtual Library) part of the url includes the word show and the details seem to match what is contained in the Omeka/Themes/Seasons/Items/show.php:
<div id="item-citation" class="element">
<h2><?php echo __('Citation'); ?></h2>
<div class="element-text"><?php echo metadata('item', 'citation', array('no_escape' => true)); ?></div>
</div>
Or, maybe it has something to do with Omeka/Application/Models/item.php:
/**
* Return a valid citation for this item.
*
* Generally follows Chicago Manual of Style note format for webpages.
* Implementers can use the item_citation filter to return a customized
* citation.
*
* @return string
*/
public function getCitation()
{
$citation = ‘’;
$creators = metadata($this, array('Dublin Core', 'Creator'), array('all' => true));
// Strip formatting and remove empty creator elements.
$creators = array_filter(array_map('strip_formatting', $creators));
if ($creators) {
switch (count($creators)) {
case 1:
$creator = $creators[0];
break;
case 2:
/// Chicago-style item citation: two authors
$creator = __('%1$s and %2$s', $creators[0], $creators[1]);
break;
case 3:
/// Chicago-style item citation: three authors
$creator = __('%1$s, %2$s, and %3$s', $creators[0], $creators[1], $creators[2]);
break;
default:
/// Chicago-style item citation: more than three authors
$creator = __('%s et al.', $creators[0]);
}
$citation .= "$creator, ";
}
$title = metadata($this, 'display_title');
if ($title) {
$citation .= "“$title,” ";
}
$siteTitle = option('site_title');
if ($siteTitle) {
$citation .= "<em>$siteTitle</em>, ";
}
$accessed = format_date(time(), Zend_Date::DATE_LONG);
$url = '<span class="citation-url">'.html_escape(record_url($this, null, true)).'</span>';
/// Chicago-style item citation: access date and URL
$citation .= __('accessed %1$s, %2$s.', $accessed, $url);
return apply_filters('item_citation', $citation, array('item' => $this));
}
Pure speculation on my part, as I don’t know php or how the different files interact with each other. But after poking around trying to figure out how/where Citations are formed, these seemed like they could be possibilities? And, after the earlier recommendation to read “Modifying Themes” in the guide, it seemed like the “show” in the url might be the indicator that that’s where I need to be looking?
Thank you for your patience and help. @jflatnes - I have not yet had a chance to try your option, but will do so later. Have to run for now. Thank you.
This is the relevant part of the error message. You seem to be missing the custom.php
and functions.php
files.
My suggestion above to empty out the custom.php except for the function being added will resolve this. The problem arises from copying the core’s custom.php, which loads a functions.php, which the theme doesn’t have.
Copying the functions.php also will not solve the issue and will just lead to more errors.
I changed the custom.php as specified. And copied and modified the browse.php from Applications/Views/Scripts . There was no visible change in the content of what was displayed in the Citation area in the right sidebar.
I’m wondering if perhaps I should just simply start over without reference to the old instructions from 2017 at the “Editing citations…” forum post and perhaps ask more directly:
I want to include data from the Source and Contributor fields to display in the Citation area on the right sidebar, such as in this example: Detail of Map of Plantations in Carroll Parish...and Issaquena County...ca. 1863 · Milliken's Bend Virtual Library
I’d like what currently appears in the citation to be followed by a statement like:
Original: [Contributor][Source]
Thanks again for your help and patience.
OK. I finally got it!!!
All I had to do was to modify the show.php inside of: Omeka/Themes/Seasons/Items.
I copied, pasted and modified the “print citation” portion of the show.php and created a separate block in the sidebar for “Original Source”. And thanks to the code provided by @jflatnes in a completely different post, I was able to get some idea of what I needed to do to make it show the Contributor and Source fields.
So my code now in show.php looks like this, in the section that begins: aside id=“sidebar”
<!-- The following prints a citation for this item. -->
<div id="item-citation" class="element">
<h2><?php echo __('Citation'); ?></h2>
<div class="element-text"><?php echo metadata('item', 'citation',
array('no_escape' => true)); ?></div>
</div>
<!-- The following prints original source for this item. -->
<div id="item-citation" class="element">
<h2><?php echo __('Original Source'); ?></h2>
<div class="element-text"><?php echo metadata($item, array('Dublin Core', 'Contributor')); ?> <?php echo metadata($item, array('Dublin Core', 'Source'),
array('no_escape' => true)); ?></div>
</div>
A sample page showing what this looks like is here: