Joomla CMS
2.5.24 (avec JPlatform 11.4 inclus)
Documentation des API du CMS Joomla en version 2.5 et du framework Joomla Platform intégré
|
Fonctions membres publiques statiques | |
static | truncate ($text, $length=0, $noSplit=true, $allowHtml=true) |
static | abridge ($text, $length=50, $intro=30) |
|
static |
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.
string | $text | The text to abridge. |
integer | $length | The maximum length of the text (default is 50). |
integer | $intro | The maximum length of the intro text (default is 30). |
Références $text, JString\strlen(), et JString\substr().
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.
string | $text | The text to truncate. |
integer | $length | The maximum length of the text. |
boolean | $noSplit | Don't split a word if that is where the cutoff occurs (default: true). |
boolean | $allowHtml | Allow HTML tags in the output, and close any open tags (default: true). |
Références $i, $text, ENT_QUOTES, JString\strlen(), JString\strrpos(), JString\substr(), et JString\trim().