Class JHtmlString

Description

HTML helper class for rendering manipulated strings.

  • abstract:
  • since: 11.1

Located in /libraries/joomla/html/html/string.php (line 19)


	
			
Method Summary
static string abridge (string $text, [integer $length = 50], [integer $intro = 30])
static string truncate (string $text, [integer $length = 0], [boolean $noSplit = true], [boolean $allowHtml = true])
Methods
static method abridge (line 137)

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.

  • return: The abridged text.
  • since: 11.1
  • access: public
static string abridge (string $text, [integer $length = 50], [integer $intro = 30])
  • 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).
static method truncate (line 36)

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.

  • return: The truncated text.
  • since: 11.1
  • access: public
static string truncate (string $text, [integer $length = 0], [boolean $noSplit = true], [boolean $allowHtml = true])
  • 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).

Documentation generated on Mon, 25 Jun 2012 13:59:51 -0500 by phpDocumentor 1.4.4