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.
How passing the component name in url gets rendered by the above statement of Joomla ?
To clarify the jdoc statement isn't passed in the URL. When Joomla is rendering index.php in your template and gets to <jdoc:include type="component" />
it will replace that block of code with the actual page content.
There are a handful of different jdoc statements, the ones you'll come across most frequently are:
<jdoc:include type="component" />
for the page content
<jdoc:include type="head" />
for head content of the page
<jdoc:include type="message" />
for system messages
<jdoc:include type="module" name="nav" title="Nav menu" />
to show a single module, in this case nav
<jdoc:include type="modules" name="col-right" style="xhtml" />
to define position on your template where you can place output from any number of modules (with thanks to Elin for pointing out my oversight with this one)
You will have any number of jdoc statements with different module names, the others should only appear once in your template.
More details
different jdoc statements: https://docs.joomla.org/Jdoc_statements
how the parsing works: https://api.joomla.org/cms-2.5/classes/JDocumentHTML.html
=== update ===
how does this statement know which content page should be rendered? Is this through the view="Page_name" ??
Yes that's correct. If you go
domain.com/index.php?option=com_content&view=article&id=1
When parsing your template's index.php file, Joomla will insert the the content for article 1 when it reaches <jdoc:include type="component" />
Here's a little more info about how what happens during the parsing
https://docs.joomla.org/Advanced_topics
The jdoc statements are rendered by classes in
/libraries/joomla/document/html/renderer/
Hope this helps!