Jelix 1.6.37

modifier.truncate.php

Plugin from smarty project and adapted for jtpl

Tags
subpackage

jtpl_plugin

contributor

Laurent Jouanneau (utf8 compliance)

contributor

Yannick Le Guédart

copyright

2001-2003 ispi of Lincoln, Inc., 2007 Laurent Jouanneau

copyright

2008 Yannick Le Guédart

link
http://smarty.php.net/
link
http://jelix.org/
licence

GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html

Table of Contents

jtpl_modifier_common_truncate()  : string
modifier plugin : Truncate a string

Functions

jtpl_modifier_common_truncate()

modifier plugin : Truncate a string

jtpl_modifier_common_truncate(string $string[, int $length = 80 ][, string $etc = '...' ][, bool $break_words = false ]) : string

Truncate a string to a certain length if necessary, optionally splitting in the middle of a word, and appending the $etc string.

{$mytext|truncate}
{$mytext|truncate:40}
{$mytext|truncate:45:'...'}
{$mytext|truncate:60:'...':true}
Parameters
$string : string

the string to truncate

$length : int = 80

the number of char to keep

$etc : string = '...'

the string to append to the truncated string

$break_words : bool = false

false if the last word shouldn't be cut

Return values
string

Search results