TTextHighlighter does syntax highlighting its body content, including static text and rendering results of child controls. You can set {@link setLanguage Language} to specify what kind of syntax the body content is. Currently, TTextHighlighter supports the following languages: ABAP, CPP, CSS, DIFF, DTD, HTML, JAVA, JAVASCRIPT, MYSQL, PERL, PHP, PYTHON, RUBY, SQL, XML and PRADO, where PRADO refers to PRADO template syntax. By setting {@link setShowLineNumbers ShowLineNumbers} to true, the highlighted result may be shown with line numbers. Note, TTextHighlighter requires {@link THead} to be placed on the page template because it needs to insert some CSS styles.
Since: 3.0
Inheritance: extends TTextProcessor
Beispiel #1
0
 /**
  * Highlights source code using TTextHighlighter
  * @param array matches of code blocks
  * @return string highlighted code.
  */
 protected function highlightCode($matches)
 {
     $text = html_entity_decode($matches[2], ENT_QUOTES, 'UTF-8');
     $this->setLanguage($matches[1]);
     return parent::processText($text);
 }