Jelix 1.6.40

modifier.truncatehtml.php

Tags
subpackage

jtpl_plugin

author

Didier Huguet

copyright

2008 Didier Huguet

link
http://snipplr.com/view.php?codeview&id=3618
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_truncatehtml()  : string
modifier plugin : cut a html formated string and close all opened tags so that it doesn't inpact on the rest of the page You should use this modifier in a zone so that the return value is cached Plugin from sniplr (original sources can be found here: http://snipplr.com/view.php?codeview&id=3618 ) <pre>{$mytext|wordwrap} {$mytext|truncatehtml:150:"\n<a href="...">read full article</a>"} {$mytext|truncatehtml:45} </pre>

Functions

jtpl_modifier_common_truncatehtml()

modifier plugin : cut a html formated string and close all opened tags so that it doesn't inpact on the rest of the page You should use this modifier in a zone so that the return value is cached Plugin from sniplr (original sources can be found here: http://snipplr.com/view.php?codeview&id=3618 ) <pre>{$mytext|wordwrap} {$mytext|truncatehtml:150:"\n<a href="...">read full article</a>"} {$mytext|truncatehtml:45} </pre>

jtpl_modifier_common_truncatehtml(string $string[, int $nbChar = 200 ][, string $etcPattern = '...' ]) : string
Parameters
$string : string

the string to truncate

$nbChar : int = 200

number of chars to keep (warning html tags included )

$etcPattern : string = '...'

the string to append to the truncated string

Return values
string

Search results