english/libraries/joomla/application/module/helper.php
/**
	 * Render the module.
	 *
	 * @param   object  $module   A module object.
	 * @param   array   $attribs  An array of attributes for the module (probably from the XML).
	 *
	 * @return  string  The HTML content of the module output.
	 *
	 * @since   11.1
	 */
Render the module.
@param   object  $module   A module object.
@param   array   $attribs  An array of attributes for the module (probably from the XML).

@return  string  The HTML content of the module output.


Render the module . @param object $module A module object . @param array $attribs An array of attributes for the module ( probably from the XML ) . @return string The HTML content of the module output .
public static function renderModule($module, $attribs = array())
	{
		static $chrome;
		if (constant('JDEBUG')) {
			JProfiler::getInstance('Application')->mark('beforeRenderModule '.$module->module.' ('.$module->title.')');
		}
		$option = JRequest::getCmd('option');
		$app	= JFactory::getApplication();
		$scope	= $app->scope;
		$app->scope = $module->module;
		$params = new JRegistry;
		$params->loadString($module->params);
		$module->module = preg_replace('/[^A-Z0-9_\.-]/i', '', $module->module);
		$path = JPATH_BASE.'/modules/'.$module->module.'/'.$module->module.'.php';
		if (!$module->user && file_exists($path)) {
			$lang = JFactory::getLanguage();
				$lang->load($module->module, JPATH_BASE, null, false, false)
			||	$lang->load($module->module, dirname($path), null, false, false)
			||	$lang->load($module->module, JPATH_BASE, $lang->getDefault(), false, false)
			||	$lang->load($module->module, dirname($path), $lang->getDefault(), false, false);
			$content = '';
			ob_start();
			require $path;
			$module->content = ob_get_contents().$content;
			ob_end_clean();
		}
		 chrome functions
		if (!$chrome) {
			$chrome = array();
		}
		require_once JPATH_THEMES.'/system/html/modules.php';
		$chromePath = JPATH_THEMES.'/'.$app->getTemplate().'/html/modules.php';
		if (!isset($chrome[$chromePath])) {
			if (file_exists($chromePath)) {
				require_once $chromePath;
			}
			$chrome[$chromePath] = true;
		}
		if (!isset($attribs['style'])) {
			$attribs['style'] = 'none';
		}
		if (JRequest::getBool('tp') && JComponentHelper::getParams('com_templates')->get('template_positions_display')) {
			$attribs['style'] .= ' outline';
		}
		foreach(explode(' ', $attribs['style']) as $style)
		{
			$chromeMethod = 'modChrome_'.$style;
			if (function_exists($chromeMethod)) {
				$module->style = $attribs['style'];
				ob_start();
				$chromeMethod($module, $params, $attribs);
				$module->content = ob_get_contents();
				ob_end_clean();
			}
		}
		$app->scope = $scope;
		if (constant('JDEBUG')) {
			JProfiler::getInstance('Application')->mark('afterRenderModule '.$module->module.' ('.$module->title.')');
		}
		return $module->content;
	}
public static function renderModule ( $ module , $ attribs = array ( ) ) { static $ chrome ; if ( constant ( 'JDEBUG' ) ) { JProfiler :: getInstance ( 'Application' ) -> mark ( 'beforeRenderModule ' . $ module -> module . ' (' . $ module -> title . ')' ) ; } $ option = JRequest :: getCmd ( 'option' ) ; $ app = JFactory :: getApplication ( ) ; $ scope = $ app -> scope ; $ app -> scope = $ module -> module ; $ params = new JRegistry ; $ params -> loadString ( $ module -> params ) ; $ module -> module = preg_replace ( '/[^A-Z0-9_\.-]/i' , '' , $ module -> module ) ; $ path = JPATH_BASE . '/modules/' . $ module -> module . '/' . $ module -> module . '.php' ; if ( ! $ module -> user && file_exists ( $ path ) ) { $ lang = JFactory :: getLanguage ( ) ; $ lang -> load ( $ module -> module , JPATH_BASE , null , false , false ) || $ lang -> load ( $ module -> module , dirname ( $ path ) , null , false , false ) || $ lang -> load ( $ module -> module , JPATH_BASE , $ lang -> getDefault ( ) , false , false ) || $ lang -> load ( $ module -> module , dirname ( $ path ) , $ lang -> getDefault ( ) , false , false ) ; $ content = '' ; ob_start ( ) ; require $ path ; $ module -> content = ob_get_contents ( ) . $ content ; ob_end_clean ( ) ; } if ( ! $ chrome ) { $ chrome = array ( ) ; } require_once JPATH_THEMES . '/system/html/modules.php' ; $ chromePath = JPATH_THEMES . '/' . $ app -> getTemplate ( ) . '/html/modules.php' ; if ( ! isset ( $ chrome [ $ chromePath ] ) ) { if ( file_exists ( $ chromePath ) ) { require_once $ chromePath ; } $ chrome [ $ chromePath ] = true ; } if ( ! isset ( $ attribs [ 'style' ] ) ) { $ attribs [ 'style' ] = 'none' ; } if ( JRequest :: getBool ( 'tp' ) && JComponentHelper :: getParams ( 'com_templates' ) -> get ( 'template_positions_display' ) ) { $ attribs [ 'style' ] .= ' outline' ; } foreach ( explode ( ' ' , $ attribs [ 'style' ] ) as $ style ) { $ chromeMethod = 'modChrome_' . $ style ; if ( function_exists ( $ chromeMethod ) ) { $ module -> style = $ attribs [ 'style' ] ; ob_start ( ) ; $ chromeMethod ( $ module , $ params , $ attribs ) ; $ module -> content = ob_get_contents ( ) ; ob_end_clean ( ) ; } } $ app -> scope = $ scope ; if ( constant ( 'JDEBUG' ) ) { JProfiler :: getInstance ( 'Application' ) -> mark ( 'afterRenderModule ' . $ module -> module . ' (' . $ module -> title . ')' ) ; } return $ module -> content ; }
Render the module.
Render the module .
// Record the scope. // Set scope to component name // Get module parameters // Get module path // Load the module // 1.5 or Core then 1.6 3PD // Load the module chrome functions // Make sure a style is set // Dynamically add outline style // Apply chrome and render module //revert the scope