Options

Options – Setting document-wide options.

Overview

HTML_Common2 provides static HTML_Common2::setOption() and HTML_Common2::getOption() methods for defining the document-wide configuration. Predefined options in HTML_Common2 are:

'charset'
Charset parameter to use in htmlspecialchars() calls, defaults to 'ISO-8859-1'
'indent'
string used to indent HTML elements, defaults to "\11"
'linebreak'
string used to indicate linebreak, defaults to "\12"

It is suggested that child classes of HTML_Common2 use the above parameters when generating HTML.

Note that setOption() and getOption() allow any option names so packages depending on HTML_Common2 may add their own configuration:

<?php
HTML_Common2
::setOption('my_option_name''My option value');
// ...
if (HTML_Common2::getOption('my_option_name')) {
    
// do something
}
?>
getOption() will return NULL for an unknown option name, it will return an array of all options and their values if option name is omitted.
Working with HTML attributes. (Previous) Protected methods, output formatting, "watched" attributes. (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.