modifier.truncatehtml.php
Tags
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