Actions

JModuleHelper/renderModule

From Joomla! Documentation

Revision as of 10:10, 7 November 2008 by Batch1211 (Talk | contribs)

Copyedit.png
This Article Needs Your Help

This article is tagged because it NEEDS REVIEW. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.


Contents

Syntax

void renderModule ( $module, [ $attribs = array()])

where:

Argument Data type Description Default
$module Object The module object see JModuleHelper/getModule
$attribs Array $attirbs['style'] defines which chrome will frame the output of the module. See: What is module chrome?

What does this method do?

This method will return the output html of the module. Language variables (JText::_('Say something');) are being translated. Furthermore the output of the module will be framed by a chrome (See: What is module chrome?). The default name of the chrome is 'none'.

Example

In the following example we'd like to load the 'mainmenu' module and particularly, we want to load the module with the title 'Key Concepts'. Furthermore we want to frame the output with the xhtml chrome:

jimport('joomla.application.module.helper');
$module = JModuleHelper::getModule('mainmenu', 'Key Concepts');
$attribs['style'] = 'xhtml';
echo JModuleHelper::renderModule($module, $attribs);
/* OUTPUT HTML:
<div class="moduletable_menu">
    <h3>Key Concepts</h3>
    <ul class="menu">
         <li class="item40"><a href="/mysnugs/extensions"><span>Extensions</span></a></li>
         <li class="item38"><a href="/mysnugs/content-layouts"><span>Content Layouts</span></a></li>
         <li class="item43"><a href="/mysnugs/example-pages"><span>Example Pages</span></a></li>
     </ul>
</div>
*/

See also