HtmlDocument
class HtmlDocument extends Document
HtmlDocument class, provides an easy interface to parse and display a HTML document
Properties
string | $title | Document title | from Document |
string | $description | Document description | from Document |
string | $link | Document full URL | from Document |
string | $base | Document base URL | from Document |
string | $language | Contains the document language setting | from Document |
string | $direction | Contains the document direction setting | from Document |
string | $_generator | Document generator | from Document |
string|Date | $_mdate | Document modified date | from Document |
string | $_tab | Tab string | from Document |
string | $_lineEnd | Contains the line end string | from Document |
string | $_charset | Contains the character encoding string | from Document |
string | $_mime | Document mime type | from Document |
string | $_namespace | Document namespace | from Document |
string | $_profile | Document profile | from Document |
array | $_scripts | Array of linked scripts | from Document |
array | $_script | Array of scripts placed in the header | from Document |
array | $_styleSheets | Array of linked style sheets | from Document |
array | $_style | Array of included style declarations | from Document |
array | $_metaTags | Array of meta tags | from Document |
object | $_engine | The rendering engine | from Document |
string | $_type | The document type | from Document |
static mixed | $_buffer | Array of buffered output | from Document |
array | $_links | Array of Header <link> tags |
|
array | $_custom | Array of custom tags | |
string | $template | Name of the template | |
string | $baseurl | Base url | |
array | $params | Array of template parameters | |
array | $_file | File name |
Methods
Class constructor
Returns the global Document object, only creating it if it doesn't already exist.
Get the contents of a document include
Sets or alters a meta tag.
Adds a linked script to the page
Adds a linked script to the page with a version to allow to flush it. Ex: myscript.js?54771616b5bceae9df03c6173babf11d If not specified Joomla! automatically handles versioning
Adds a script to the page
Add option for script
Adds a linked stylesheet to the page
Adds a linked stylesheet version to the page. Ex: template.css?54771616b5bceae9df03c6173babf11d If not specified Joomla! automatically handles versioning
Adds a stylesheet declaration to the page
Sets the global document language declaration. Default is English (en-gb).
Sets the global document direction declaration. Default is left-to-right (ltr).
Sets the document MIME encoding that is sent to the browser.
Return the document MIME encoding that is sent to the browser.
Sets the line end style to Windows, Mac, Unix or a custom string.
Outputs the template to the browser.
Get the HTML document head data
Reset the HTML document head data
Set the HTML document head data
Merge the HTML document head data
Adds <link>
tags to the head of the document
Adds a shortcut icon (favicon)
Adds a custom HTML string to the head block
Returns whether the document is set up to be output as HTML5
Sets whether the document should be output as HTML5
Count the modules based on the given condition
Count the number of child menu items of the current active menu item
Details
static
object
getInstance(
string $type = 'html',
array $attributes = array())
Returns the global Document object, only creating it if it doesn't already exist.
mixed
getBuffer(
string $type = null,
string $name = null,
array $attribs = array())
Get the contents of a document include
Document
setMetaData(
string $name,
mixed $content,
string $attribute = 'name')
Sets or alters a meta tag.
Document
addScript(
string $url,
array $options = array(),
array $attribs = array())
Adds a linked script to the page
Document
addScriptVersion(
string $url,
array $options = array(),
array $attribs = array())
Adds a linked script to the page with a version to allow to flush it. Ex: myscript.js?54771616b5bceae9df03c6173babf11d If not specified Joomla! automatically handles versioning
Document
addScriptDeclaration(
string $content,
string $type = 'text/javascript')
Adds a script to the page
Document
addStyleSheet(
string $url,
array $options = array(),
array $attribs = array())
Adds a linked stylesheet to the page
Document
addStyleSheetVersion(
string $url,
array $options = array(),
array $attribs = array())
Adds a linked stylesheet version to the page. Ex: template.css?54771616b5bceae9df03c6173babf11d If not specified Joomla! automatically handles versioning
Document
addStyleDeclaration(
string $content,
string $type = 'text/css')
Adds a stylesheet declaration to the page
Document
setLanguage(
string $lang = 'en-gb')
Sets the global document language declaration. Default is English (en-gb).
Document
setDirection(
string $dir = 'ltr')
Sets the global document direction declaration. Default is left-to-right (ltr).
Document
setMimeEncoding(
string $type = 'text/html',
boolean $sync = true)
Sets the document MIME encoding that is sent to the browser.
This usually will be text/html because most browsers cannot yet accept the proper mime settings for XHTML: application/xhtml+xml and to a lesser extent application/xml and text/xml. See the W3C note ({@link http://www.w3.org/TR/xhtml-media-types/ http://www.w3.org/TR/xhtml-media-types/}) for more details.
Document
setLineEnd(
string $style)
Sets the line end style to Windows, Mac, Unix or a custom string.
void
render(
boolean $caching = false,
array $params = array())
Outputs the template to the browser.
HtmlDocument
addHeadLink(
string $href,
string $relation,
string $relType = 'rel',
array $attribs = array())
Adds <link>
tags to the head of the document
$relType defaults to 'rel' as it is the most common relation type used.
('rev' refers to reverse relation, 'rel' indicates normal, forward relation.)
Typical tag: <link href="index.php" rel="Start">
HtmlDocument
addFavicon(
string $href,
string $type = 'image/vnd.microsoft.icon',
string $relation = 'shortcut icon')
Adds a shortcut icon (favicon)
This adds a link to the icon shown in the favorites list or on the left of the url in the address bar. Some browsers display it on the tab, as well.