Limit length of description text of items in "browse" view

Hi there,

I’m using Omeka S 3.10 and have the theme Thanks, Roy in use.

Could anyone indicate if I can reduce the amount of description text showing in the “browse” view by modifying code?

Thank you very much in advance.

The file that controls the browse display is view/omeka/site/item/browse.phtml within the theme, and it’s the $body variable that’s what prints the description.

You could use the PHP function mb_substr to cut out extra length you don’t want of the $body before it’s printed. For example, to limit it to 100 characters could look like:

$maxLength = 100;
$body = mb_substr((string) $body, 0, $maxLength, 'UTF-8');

placed somewhere after $body is defined but before it is printed.

2 Likes

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