3

If we need ton integrate a module in a template, we add this code in the index.php :

<?php if ($this->countModules('position-4')): ?>
    <jdoc:include type="modules" name="position-4" style="xhtml" />
<?php endif; ?>

But how can we integrate a component ?

I’ve installed a module that appears in the component menu and i don’t see any module position there.

3

The define the area where a component is displayed, you need to add the following somewhere in your template index.php:

<jdoc:include type="component" />

Do bare in mind that this should only be used once

For more information in jdoc include statements, have a read of the following:

http://docs.joomla.org/Jdoc_statements

Hope this helps

  • Perfect, it works. So in a template, if i need a component on a specific page, i need to link a menu item to the component and add this code in the template with a condition to check the id of the menu item ? – Sébastien Gicquel Aug 11 '14 at 10:13
  • No, this is where the dynamic side kicks in. The template index.php is only used to define where you want to display things. If you want a component on a specific page, simply create a new menu item in the Joomla backend and set the type to which ever component you wish to use – Lodder Aug 11 '14 at 10:16
  • Yes, i know how to do that. I’m creating a template from scratch and i need a specific design for a component. I was wondering how to integrate it in index.php According to your comment, i only need <jdoc:include type="component" /> once. I think i need to review my template structure. – Sébastien Gicquel Aug 11 '14 at 10:23
  • Ahh I see. In this case you should create a Template Override – Lodder Aug 11 '14 at 10:29

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.