Support Joomla!

references:joomla.framework:document:jdocument-getinstance

Table of Contents

getInstance

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Document Class JDocument Method getInstance Reference getInstance() Never Work in Progress

This function returns an object that is of a type that is dependent on the document type. The default document type is html. Currently this is the only type that has been implemented.

This method must be invoked as:

  $document = &JDocument::getInstance();

Syntax

jdocument &getInstance ( $type, $attributes )

$type type is a string containing the type of document to instantiate.
$attributes mixed is an associative array containing the attributes to pass to the class constructor. See __construct for more information.

Examples

This function is called from the JApplication::getDocument function and should not need to be called otherwise. This function is called in the following way:

Example

$attributes = array (
                     'charset'  => 'utf-8',
           	     'lineend'  => 'unix',
                     'tab'  => '  ',
          	     'language' => 'en-GB'
		    );
jimport('joomla.document.document');
$instance =& JDocument::getInstance('html', $attributes);

This results in an object of type JDocumentHTML being assigned to the $instance variable.

 
references/joomla.framework/document/jdocument-getinstance.txt (178704 views) · Last modified: 2007/08/15 14:53