2

I want to be able to load a specific module from a position in a Joomla template. I have more than one module assigned to that position for other templates but for this new template I only want to load for example a module by name, or a module by index from that position.

Is that possible using the jdoc:include tag? or is there any other way to make it?

An example of a classic template position load that I use:

<jdoc:include type="modules" style="xhtml" name="maintop-a" />

4 Answers 4

2

Documentation says :

Module

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

This element renders a single module given by the name and title attributes: name should match module type (mod_breadcrumbs and mod_menu in the examples above) while title should be the module name of the desired module. The module in question must be published and accessible by the current user in order to become visible. Additional attributes can be provided to control the layout and appearance of the module, if supported.

Is that what you need?

2

Did you try a custom html module with the following: {loadposition your-position-here}? For example:

{loadposition header-x}

And you will load the modules in the position "header-x".

1

I'm not sure if this is what you're looking for, but you can use JModuleHelper::getModule to load any module by name:

jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule( 'mainmenu', 'Key Concepts' );
$attribs['style'] = 'xhtml';
echo JModuleHelper::renderModule( $module, $attribs );

For example usage, take a look at this documentation.

1

try this simple plugin

http://extensions.joomla.org/extension/load-module-into-article

This plugin displays any module into an article.

Syntax in editor:

{module [63]} where 63 is the id of the module you want to load.

I hope it will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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