Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

xHTML Helper

Derek Jones edited this page · 5 revisions
Clone this wiki locally

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');
Something went wrong with that request. Please try again.