Forums » Short exhibit description snippet on exhibit browse page

RSS feed for this topic

Info

  1. I'd like to include short snippets (~250 characters) of my exhibit descriptions on my exhibit browse page. I've got a sneaking suspicion the problem/answer must be something rather obvious to another set of eyes.

    The relevant bit of my code in plugins/ExhibitBuilder/views/public/exhibits/browse.php goes as such:

    <div id="exhibits">
        <?php $exhibitCount = 0; ?>
        <?php while(loop_exhibits()): ?>
        	<?php $exhibitCount++; ?>
        	<div class="exhibit <?php if ($exhibitCount%2==1) echo ' even'; else echo ' odd'; ?>">
        		<h2><?php echo link_to_exhibit(); ?></h2>
        		<div class="description"><?php echo exhibit('Description', array('snippet' => 300)); ?></div>
        	</div>
        <?php endwhile; ?>
    </div>

    In the page that results, though, the description is there, in full, un-snipped. Any clues?

  2. Unlike item(), the Exhibit Builder's exhibit() function doesn't support many options, including the 'snippet' option.

    Instead, you can pass the output from exhibit() to Omeka's snippet() helper:

    <?php echo snippet(exhibit('Description'), 0, 300); ?>

Reply

You must log in to post.