-
Notifications
You must be signed in to change notification settings - Fork 7.6k
xHTML Helper
Category:Helper::Community | Category:Helper::XHTML [h3]Introduction[/h3] The xHTML Helper currently provides 3 functions to assist in developing standards compliant xHTML 1.0 STRICT code. [h3]Download[/h3] File:xhtml_helper.zip
[h3]Usage[/h3] [h4]xhtml_doctype($language, $dtd);[/h4] This function will return a valid doctype statement based on the language and DTD passed to it. If you select a DTD that is not valid for a selected language, this helper will return an xHTML comment stating the error and the STRICT doctype for the selected language. If you select an incorrect language, this helper will return an xHTML comment stating the error and the XHTML1 STRICT doctype.
This helper defaults to XHTML1 STRICT if no parameters are passed to it.
[h4]Example[/h4]
// Output XHTML1 STRICT doctype
xhtml_doctype();
// Output HTML4 FRAMESET doctype
xhtml_doctype('html4', 'frameset');
// Error - there is no XHTML 1.1 STRICT doctype, output comment and XHTML 1.1 DTD
xhtml_doctype('xhtml11', 'strict');
[h4]xhtml_html($xmlns)[/h4] This function will return an xHTML1 STRICT HTML tag with the namespace parameter. This helper defaults to http://www.w3.org/1999/xhtml if no parameters are passed to it. [h4]Example[/h4]
// Use http://www.w3.org/1999/xhtml Namespace
xhtml_html();
// Use http://xmlns.com/wot/0.1/ Namespace
xhtml_html('http://xmlns.com/wot/0.1/');
[h4]xhtml_contentType($charset)[/h4] This function will return an XHTML1 STRICT META tag for the Content-Type charset encoding. This helper defaults to utf-8 if no parameters are passed to it. [h4]Example[/h4]
// Use utf-8
xhtml_contentType();
// Use ISO-8859-1
xhtml_contentType('ISO-8859-1');