Load module position in template override in Joomla 2.5

joomla extension fix id

Just a quick one that I always struggle to find. If you have a template override in something like K2, or just a simple com_content override, then sometimes it’s useful to load a module position within the override rather than using the normal module manager and positions.

In your override pop the following code in between your PHP tags.

// This loads the module position
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('modules');
$options = array('style' => 'raw');
echo $renderer->render($position, $options, null);

Obviously you need the correct position published in your template. You can also add extra options is you require.