[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Source view] [Print] [Project Stats]
Joomla! Content Management System
Copyright: | (C) 2010 Open Source Matters, Inc. |
License: | GNU General Public License version 2 or later; see LICENSE.txt |
File Size: | 279 lines (11 kb) |
Included or required: | 0 times |
Referenced: | 2 times |
Includes or requires: | 0 files |
truncate($text, $length = 0, $noSplit = true, $allowHtml = true) X-Ref |
Truncates text blocks over the specified character limit and closes all open HTML tags. The method will optionally not truncate an individual word, it will find the first space that is within the limit and truncate at that point. This method is UTF-8 safe. param: string $text The text to truncate. param: integer $length The maximum length of the text. param: boolean $noSplit Don't split a word if that is where the cutoff occurs (default: true). param: boolean $allowHtml Allow HTML tags in the output, and close any open tags (default: true). return: string The truncated text. |
truncateComplex($html, $maxLength = 0, $noSplit = true) X-Ref |
Method to extend the truncate method to more complex situations The goal is to get the proper length plain text string with as much of the html intact as possible with all tags properly closed. param: string $html The content of the introtext to be truncated param: integer $maxLength The maximum number of characters to render param: boolean $noSplit Don't split a word if that is where the cutoff occurs (default: true). return: string The truncated string. If the string is truncated an ellipsis |
abridge($text, $length = 50, $intro = 30) X-Ref |
Abridges text strings over the specified character limit. The behavior will insert an ellipsis into the text replacing a section of variable size to ensure the string does not exceed the defined maximum length. This method is UTF-8 safe. For example, it transforms "Really long title" to "Really...title". Note that this method does not scan for HTML tags so will potentially break them. param: string $text The text to abridge. param: integer $length The maximum length of the text (default is 50). param: integer $intro The maximum length of the intro text (default is 30). return: string The abridged text. |
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |