6

Hi I am a newbie in Joomla and want to understand one of the functionalities of the Joomla.

In joomla templates we use

jdoc:include type="component"

statement. But I am not able to understand how this functionality has been implemented in Joomla. How passing the component name in url gets rendered by the above statement of Joomla ? Please help me to understand.

5

Starting from this sentence in Joomla docs:

The jdoc:include statement is a Joomla! template's method of displaying content specific to the page being viewed. There are various jdoc:include statements, each returning a different part of a Joomla! page. The replacement itself is done in JDocumentHTML::_renderTemplate. See also _parseTemplate.

I've analyzed the JDocumentHTML class in /libraries/joomla/document/html/html.php and it seems that Joomla loads the template and search in it for jdoc statements, with the getBuffer function retrieves the code to add instead of jdoc.

foreach ($this->_template_tags as $jdoc => $args){
    $replace[] = $jdoc;
    $with[] = $this->getBuffer($args['type'], $args['name'], $args['attribs']);
}
return str_replace($replace, $with, $this->_template);

The getBuffer function calls another render function to specifically load the correct component or module. For components the code is this:

$renderer = $this->loadRenderer($type);
...
$this->setBuffer($renderer->render($name, $attribs, null), $type, $name, $title);

Anyway at this point I got a little confused and cannot understand how the various renderers actually works, let's see if anybody else knows the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.