API15

API15:JDocument/loadRenderer

From Joomla! Documentation

Revision as of 22:18, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Load a renderer <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span>...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Load a renderer

[Edit Descripton]

Template:Description:JDocument/loadRenderer

Syntax

& loadRenderer($type)
Parameter Name Default Value Description
$type The renderer type

Returns

object

Defined in

libraries/joomla/document/document.php

Importing

jimport( 'joomla.document.document' );

Source Body

function &loadRenderer( $type )
{
        $null   = null;
        $class  = 'JDocumentRenderer'.$type;

        if( !class_exists( $class ) )
        {
                $path = dirname(__FILE__).DS.$this->_type.DS.'renderer'.DS.$type.'.php';
                if(file_exists($path)) {
                        require_once($path);
                } else {
                        JError::raiseError(500,JText::_('Unable to load renderer class'));
                }
        }

        if ( !class_exists( $class ) ) {
                return $null;
        }

        $instance = new $class($this);
        return $instance;
}

[Edit See Also] Template:SeeAlso:JDocument/loadRenderer

Examples

<CodeExamplesForm />