Sometimes there is a situation where we need to load the module or a module position in body of component, for example to publish a banner between articles of social icons. In this case, it may help to one of the above constructions.

  1. Load module breadcrums with two parameters.
    (Show "You are here" = No and Text Separator = /)

    		/* start load module breadcrums */
    		jimport( 'joomla.application.module.helper' );
    		$module = JModuleHelper::getModule( 'mod_breadcrumbs' );
    		$module->params = "showHere=0\n\rseparator=/";	
    		echo JModuleHelper::renderModule($module);		
    		/* end modele breadcrums */
    
  2. Load module position article-banners

               
                    /* start load module position*/
                    $document   = &JFactory::getDocument();
                    $renderer   = $document->loadRenderer('modules');
                    $options    = array('style' => 'xhtml');
                    $position   = 'article-banners';
                    echo $renderer->render($position, $options, null);
                    /* end load module posotion */
    
  3. Load module by ID

               
                    /* start load module by ID*/               
                    $document = JFactory::getDocument();
    		$renderer = $document->loadRenderer('module');
    		$contents = '';
                    //Add Module ID = 1
    		$module_id = 1;
                    // add module positions style		
    		$module_style = 'xhtml';					
    		//get module as an object
    		$database = JFactory::getDBO();
    		$database->setQuery("SELECT * FROM #__modules WHERE id='$module_id' ");
    		$modules = $database->loadObjectList();
    		$module = $modules[0];						
    		//just to get rid of that stupid php warning
    		$module->user = '';
    		//add module position parameters 			
    		$params = array('style'=>$module_style);					
    		$contents = $renderer->render($module, $params);
    		echo $contents;
                    /* end load module by ID */