The shorten template operator
Registered in lib/eztemplate/classes/eztemplateautoload.php by the class eZTemplateStringOperator (lib/eztemplate/classes/eztemplatestringoperator.php).
The same class also registers: upcase, downcase, count_words, count_chars, trim, break, wrap, upfirst, upword, simplify, trim, wash, chr, ord, pad.
Parameters
| Parameter | Type | Required | Default |
|---|---|---|---|
chars_to_keep | integer | no | 80 |
str_to_append | string | no | '...' |
trim_type | string | no | 'right' |
The operator works on its input: the value before |.
Example
Built from the parameter list above; the values are placeholders (the operator's template hints decide whether it takes an input).
$value|shorten( 80, '...', 'right' )In a shipped template
The first use in the templates of this installation, design/admin/templates/audit/console.tpl line 132:
<td>if $e.request<a href=$e.request_url|ezurl><code>$e.request|shorten( 14 )|wash</code></a>/ifif $e.engine<br /><span class="a4-audit-sub">$e.engine|washif $e.siteaccess, $e.siteaccess|wash/if</span>/if</td>Related
Generated by ./console exp:help:examples from lib/eztemplate/classes/eztemplateautoload.php, lib/eztemplate/classes/eztemplatestringoperator.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.