InMotion Hosting Support Center

What is <jdoc:include....... is it html, php or what?

Category: Joomla

2013-04-04 9:00 am EST

Hits: 9,408
Can anyone tell me what <jdoc: include....... is? is it html, php or what? And please please please can someone point me to the API describing the jdoc statement so that I can trace see exactly how the jdoc statements in my template generate code? I presume the jdoc statement is some sort of Joomla code to generate html content, but since the statements are part of a php script, they will have to be parsed by the php interpreter? Or not?

You must login before you can ask a follow up question.

You must login before you can submit an answer.

For instance: <jdoc:include type="component" /> looks like html - it begins with '<' and ends with /> (html shorthand for the closing tag).
But it is not included in the official html tag list. It also doesn't look like any php code which I can recognize as such (in php the colon is usually used to replace the { in some shorthand constructs). In the index.php script of a Joomla template the instruction actually generates page content, although the statement doesn't actually say what component is being called (e.g. banners, contact, content, newsfeed, etc.). So how does the index.php decide which component is to be called when the template is executed?
34 Points
2013-04-04 09:13 am EST



31,035 Points
2013-04-04 10:21 am EST
Hello ClubAero,

Thank you for your question. Jdoc is syntax that is specific to Joomla, and is used in templates for formatting. Here is a link to the official Joomla documentation that explains jdoc statements.

Also, here is a link to our article on "How to add CSS and JavaScript files to a Joomla 3.0 Template ," in step 4 we work with the jdoc statement.

If you have any further questions, feel free to post them below.
Thank you,


You must login before you can post a comment about this answer.

Hi John-Paul Thanks for your answer. Unfortunately the link you gave me for the joomla documentation explains very little. It just mentions the jdoc:include options such as 'component', 'head', 'module' etc.
Presumably I have to consider Joomla syntax as sort of high level language which calls PHP classes and methods? But if this is so it will have to be parsed by a Joomla interpreter in order to generate the PHP instructions which in turn generate the html output? But surely the index.php in the Joomla template is parsed by PHP, not by Joomla? And do you know of a programmer's guide which specifies the code generated by jdoc statements? (A sort of API?)
34 Points
2013-04-04 11:37 am EST
Hello ClubAero,

The jdoc syntax is Joomla's way of being able to include extra functionality easily into your templates without the need for having to write new PHP code. For example the following jdoc command:

<jdoc:include type="module" name="mainmenu" title="Main Menu" />

Would create a menu module for you to output content, the way Joomla uses this syntax just makes it easier to include things rather than having to use raw PHP code.

For a more in-depth explanation on the process Joomla uses to process jdoc commands you can check out Joomla advanced topics | how are templates executed.

Please let us know if you had any other questions.

- Jacob
9,968 Points
2013-04-05 2:31 pm EST

2013-10-09 8:59 am EST
probably Joomla uses trick with PHP output buffering - this allows to get HTML into PHP variable instead of simply returning it to web browser, modify content of this variable (ie. replace these jdoc statements) and at the end send modified contents to browser. Look ad PHP documentation and ob_start(), ob_clean(), ob_get_contents() etc.

You must login before you can post a comment about this answer.

Thanks for your answers. I guess I wasn’t clear enough with my question “what is <jdoc:include…… ?”.
In the case of <jdoc:include type="component" /> what I needed to know was: what is the coding that Joomla (version 3.2) generates from the <jdoc:include type="component" /> statement in order to render content and display content in a page on my website?
Or better still – can someone point me to the Joomla api for Joomla 3.2 which shows the classes and methods which are generated by <jdoc:include type="component" /> ? It is probably contained in github? But unfortunately I still haven’t discovered how to select coding from github and to download the code in order to study it with a text editor.
In the meantime I found this partial answer to my question:
On encountering a
<jdoc:include type="mytype" name="myname" class="myclass" /> statement in the document template, this is effectively the call that would be made (the actual call is made in the private method JDocumentHTML->_parseTemplate):
$doc =& JFactory::getDocument();
$buffer = $doc->getBuffer(‘mytype’, ‘myname’, array(‘class’=> ‘myclass’));
See also
• JDocumentHTML->getBuffer on
• JDocumentHTML->setBuffer
34 Points
2014-01-05 11:57 am EST
This statement would indeed generate content on the page. Each Jdoc statement is explained within the following in Jooml'a documentation:

Joomla Jdoc statements
11,186 Points
2014-01-06 9:53 am EST
Like this Question?

Joomla Community Google+ Hangout #3

June 3rd, 2014

Thank you @RustyJoomla for letting me speak on the Joomla Community Google+ Hangout!

Click here to watch!

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!