Skip to content
Derek Jones edited this page Jul 4, 2012 · 5 revisions

Category:Helper::Community | Category:Helper::XHTML

Introduction

The xHTML Helper currently provides 3 functions to assist in developing standards compliant xHTML 1.0 STRICT code.

Download

File:xhtml_helper.zip

Usage

xhtml_doctype($language, $dtd);

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.

Example

// 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');

xhtml_html($xmlns)

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.

Example

// 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/');

xhtml_contentType($charset)

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.

Example

// Use utf-8
xhtml_contentType();

// Use ISO-8859-1
xhtml_contentType('ISO-8859-1');
Clone this wiki locally