Posted By

jacobpdq on 07/05/10


Tagged

template module joomla


Versions (?)

Load Module Outside Template


 / Published in: PHP
 

URL: http://jeffchannell.com/Joomla/load-a-joomla-module-position-without-using-jdoc-tags.html

  1. <?php
  2. require_once(JPATH_ROOT.DS.'libraries'.DS.'joomla'.DS.'application'.DS.'module'.DS.'helper.php');
  3. $document =& JFactory::getDocument();
  4. $renderer = $document->loadRenderer('module');
  5. $db =& JFactory::getDBO();
  6. $db->setQuery("SELECT * FROM #__modules WHERE position='positionname' AND published=1 ORDER BY ordering");
  7. $modules = $db->loadObjectList();
  8. if( count( $modules ) > 0 )
  9. {
  10. foreach( $modules as $module )
  11. {
  12. //just to get rid of that stupid php warning
  13. $module->user = '';
  14. $params = array('style'=>'xhtml');
  15. echo $renderer->render($module, $params);
  16. }
  17. }

Report this snippet  

You need to login to post a comment.