truncate

1.0 1.1 1.2 1.3

Truncates a string at the given length

<?php
truncate(string $value, [ int $length = 80, [ string $etc = '...', [ bool $break = false, [ bool $middle = false ]]]])

Examples

Example #1

index.tpl
{truncate "this text is really too long, or let's just pretend it is will you?" 30 middle=true}
{strlen truncate("this text is really too long, or let's just pretend it is will you?" 30 middle=true)} {* here we check its length to verify it's 30 chars alright *}

The above example will output:

this text is r... is will you?
30