Display or render Joomla 2.5 module using PHP

Useful in Virtuemart or elsewhere:

/* may be necessary to include: jimport( 'joomla.application.module.helper' ); */

$mainframe =& JFactory::getApplication('site');
 
$modules = JModuleHelper::getModules('left');
$document   = JFactory::getDocument();
$renderer   = $document->loadRenderer('module');
$attribs = array('style' => 'xhtml');
$contents = '';
foreach( $modules As $mod ){
    $contents .= $renderer->render($mod, $attribs);
}
echo $contents;

Leave a Reply