Get title of nav item from within item browse template

I want to create a Browse-type item in the nav with a specific query, and then display the label for the nav item in the template, as if it were a page title. Eg I would create a Browse-type item in the nav with the label ‘Events’, and then I want to display ‘Events’ in the browse template.

Is it possible or should I just use a page with an embedded browse preview for a case like this?

In the default template for omeka/site/item/browse.phtml, there is the following code:

<?php if ($itemSetShow): ?>
   // irrelevant stuff...
<?php else: ?>
    <?php echo $this->pageTitle($translate('Items'), 2); ?>
<?php endif; ?>

I basically want to replace the hardcoded Items in the else-branch with the name of the nav item that was clicked on to get to this page.

If you have something that represents the string you want to display in the query/URL you’re using, you could look that up in the view and print it (or use the query value to look up a string that you’d display).

Regular old $_GET will work for this, as will the Omeka S view helper params:

$this->params('your_query_parameter')

Be sure, if you go down the road of printing out something from the query string, that you make sure to escape it before printing it to avoid introducing an XSS vulnerability:

echo $this->escapeHtml($yourStringToPrint)

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.