Loading a module in a component output

Written by khawaib

Topics: Joomla! 1.5

Soluotions 1:

defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.module.helper');
$mod = JModuleHelper::getModule('name_of_module');
echo JModuleHelper::renderModule($mod);

If you want to output all modules on a certain position, then use JModuleHelper::getModules(‘name_of_position’) and render the array of modules in a foreach-loop. Some XML around it and you have a XML-output (often used that to get modules into Flash).

Solution 2:

Create an article that only contains the module, by using {loadposition}, and then display that article with a template that only outputs <jdoc:include type="component" />

Leave a Comment Here's Your Chance to Be Heard!

You must be logged in to post a comment.