class JHtmlString


Located at : UKNOWVA_ROOT/libraries/joomla/html/html/string.php

HTML helper class for rendering manipulated strings.

Methods

static string
truncate(string $text, integer $length)

Truncates text blocks over the specified character limit and closes all open HTML tags. The behavior will 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.

static string
abridge(string $text, integer $length = 50, integer $intro = 30)

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.

Details

at line 34
static string truncate(string $text, integer $length)

Truncates text blocks over the specified character limit and closes all open HTML tags. The behavior will 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.

Parameters

string $text The text to truncate.
integer $length The maximum length of the text.

Return Value

string The truncated text.

at line 101
static string abridge(string $text, integer $length = 50, integer $intro = 30)

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.

eg. Transform "Really long title" to "Really...title"

Parameters

string $text The text to abridge.
integer $length The maximum length of the text.
integer $intro The maximum length of the intro text.

Return Value

string The abridged text.