Table of Contents

parse

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

Parse a document template. This method will read and parse the specified document template file. By default, it will parse the index.php file located in the $template subdirectory in ‘templates’.

Syntax

void parse ( $template, $filename, $directory )

$template string is a string containing the name of the template to look for the file.
$filename string is a string containing the actual filename of the template. This parameter is optional and if omitted defaults to ‘index.php’.
$directory string is a string containing the directory in which to look for the template. This parameter is optional and if omitted defaults to ‘templates’.

Examples

The ‘rhuk_milkyway’ document template in the core installation would be loaded in the following way:

Example

global $mainframe;

$document =& JFactory::getDocument();
$document->parse( 'rhuk_milkyway' );

Templates are stored in the /templates directory using a subdirectory that is the name of the template. Therefore, this function will, by default, parse the file /templates/$template/index.php. In this case, $template is ‘rhuk_milkyway’, so the parsed file will be /templates/rhuk_milkyway/index.php. If this function is called from the Backend, this directory will be relative to the ‘administrator’ and will therefore load the specified admin template.