Back to Joomla project (class list)

Class HtmlDocument - list of methods

HtmlDocument class, provides an easy interface to parse and display a HTML document

Extends

Direct known subclasses

Package: Joomla\CMS\Document
Copyright: (C) 2005 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Document/HtmlDocument.php
Project: Joomla

Method Summary

public
(mixed $options = array())

Class constructor
Parameters
  • array $options Associative array of options
Since
  • 1.7.0
Show source code of this method: __construct Source Code

public array
()

Get the HTML document head data
Returns
  • array The document head data in array form
Since
  • 1.7.0
Show source code of this method: getHeadData Source Code

public \Joomla\CMS\Document\HtmlDocument
(mixed $types = null)

Reset the HTML document head data
Parameters
  • mixed $types type or types of the heads elements to reset
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 3.7.0
Show source code of this method: resetHeadData Source Code

private void
(mixed $type)

Reset a part the HTML document head data
Parameters
  • string $type type of the heads elements to reset
Returns
  • void
Since
  • 3.7.0
Show source code of this method: resetHeadDatum Source Code

public \Joomla\CMS\Document\HtmlDocument|null
(mixed $data)

Set the HTML document head data
Parameters
  • array $data The document head data in array form
Returns
  • \Joomla\CMS\Document\HtmlDocument|null instance of $this to allow chaining or null for empty input data
Since
  • 1.7.0
Show source code of this method: setHeadData Source Code

public \Joomla\CMS\Document\HtmlDocument|void
(mixed $data)

Merge the HTML document head data
Parameters
  • array $data The document head data in array form
Returns
  • \Joomla\CMS\Document\HtmlDocument|void instance of $this to allow chaining or void for empty input data
Since
  • 1.7.0
Show source code of this method: mergeHeadData Source Code

public \Joomla\CMS\Document\HtmlDocument
(mixed $href, mixed $relation, mixed $relType = 'rel', mixed $attribs = array())

Adds `<link>` tags to the head of the document
Parameters
  • string $href The link that is being related.
  • string $relation Relation of link.
  • string $relType Relation type attribute. Either rel or rev (default: 'rel').
  • array $attribs Associative array of remaining attributes.
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 1.7.0
Show source code of this method: addHeadLink Source Code

public \Joomla\CMS\Document\HtmlDocument
(mixed $href, mixed $type = 'image/vnd.microsoft.icon', mixed $relation = 'shortcut icon')

Adds a shortcut icon (favicon)
Parameters
  • string $href The link that is being related.
  • string $type File type
  • string $relation Relation of link
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 1.7.0
Show source code of this method: addFavicon Source Code

public \Joomla\CMS\Document\HtmlDocument
(mixed $html)

Adds a custom HTML string to the head block
Parameters
  • string $html The HTML to add to the head
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 1.7.0
Show source code of this method: addCustomTag Source Code

public bool
()

Returns whether the document is set up to be output as HTML5
Returns
  • bool true when HTML5 is used
Since
  • 3.0.0
Show source code of this method: isHtml5 Source Code

public void
(mixed $state)

Sets whether the document should be output as HTML5
Parameters
  • bool $state True when HTML5 should be output
Returns
  • void
Since
  • 3.0.0
Show source code of this method: setHtml5 Source Code

public mixed|string
(mixed $type = null, mixed $name = null, mixed $attribs = array())

Get the contents of a document include
Parameters
  • string $type The type of renderer
  • string $name The name of the element to render
  • array $attribs Associative array of remaining attributes.
Returns
  • mixed|string The output of the renderer
Since
  • 1.7.0
Show source code of this method: getBuffer Source Code

public \Joomla\CMS\Document\HtmlDocument
(mixed $content, mixed $options = array())

Set the contents a document includes
Parameters
  • string $content The content to be set in the buffer.
  • array $options Array of optional elements.
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 1.7.0
Show source code of this method: setBuffer Source Code

public \Joomla\CMS\Document\HtmlDocument
(mixed $params = array())

Parses the template and populates the buffer
Parameters
  • array $params Parameters for fetching the template
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 1.7.0
Show source code of this method: parse Source Code

public string
(mixed $caching = false, mixed $params = array())

Outputs the template to the browser.
Parameters
  • bool $caching If true, cache the output
  • array $params Associative array of attributes
Returns
  • string The rendered data
Since
  • 1.7.0
Show source code of this method: render Source Code

public int
(string $positionName, bool $withContentOnly = false)

Count the modules in the given position
Parameters
  • string $positionName The position to use
  • bool $withContentOnly Count only a modules which actually has a content
Returns
  • int Number of modules found
Since
  • 1.7.0
Show source code of this method: countModules Source Code

public int
()

Count the number of child menu items of the current active menu item
Returns
  • int Number of child menu items
Since
  • 1.7.0
Show source code of this method: countMenuChildren Source Code

protected string
(mixed $directory, mixed $filename)

Load a template file
Parameters
  • string $directory The name of the template
  • string $filename The actual filename
Returns
  • string The contents of the template
Since
  • 1.7.0
Show source code of this method: _loadTemplate Source Code

protected \Joomla\CMS\Document\HtmlDocument
(mixed $params = array())

Fetch the template, and initialise the params
Parameters
  • array $params Parameters to determine the template
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 1.7.0
Show source code of this method: _fetchTemplate Source Code

protected \Joomla\CMS\Document\HtmlDocument
()

Parse a document template
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 1.7.0
Show source code of this method: _parseTemplate Source Code

protected string
()

Render pre-parsed template
Returns
  • string rendered template
Since
  • 1.7.0
Show source code of this method: _renderTemplate Source Code

Properties Summary

public array
$_links
Array of Header `` tags
Since
  • 1.7.0
public array
$_custom
Array of custom tags
Since
  • 1.7.0
public string
$template
Name of the template
Since
  • 1.7.0
public string
$baseurl
Base url
Since
  • 1.7.0
public array
$params
Array of template parameters
Since
  • 1.7.0
public array
$_file
File name
Since
  • 1.7.0
public string|null
$cspNonce
Script nonce (string if set, null otherwise)
Since
  • 4.0.0
protected string
$_template
String holding parsed template
Since
  • 1.7.0
protected array
$_template_tags
Array of parsed template JDoc tags
Since
  • 1.7.0
protected int
$_caching
Integer with caching setting
Since
  • 1.7.0
private bool
$html5
Set to true when the document should be output as HTML5
Since
  • 4.0.0

Tags Summary

Since
1.7.0