Difference between revisions of "JDocumentRendererModule/render"
From Joomla! Documentation
< API16:JDocumentRendererModule
(New page: ===Description===
Renders a module script and returns the results as a string
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JDocumentRendererModule...) |
m (removing red link to edit, no existant pages) |
||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 92: | Line 92: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 107: | Line 107: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API16]] |
Revision as of 00:02, 13 May 2013
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Renders a module script and returns the results as a string
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
render($module, $params=array(), $content=null)
Parameter Name | Default Value | Description |
---|---|---|
$module | $name The name of the module to render | |
$params | array() | $params Associative array of values |
$content | null |
Returns[edit]
string The output of the script
Defined in[edit]
libraries/joomla/document/html/renderer/module.php
Importing[edit]
jimport( 'joomla.document.html.renderer.module' );
Source Body[edit]
public function render($module, $params = array(), $content = null)
{
if (!is_object($module))
{
$title = isset($params['title']) ? $params['title'] : null;
$module = &JModuleHelper::getModule($module, $title);
if (!is_object($module))
{
if (is_null($content)) {
return '';
}
else {
$tmp = $module;
$module = new stdClass();
$module->params = null;
$module->module = $tmp;
$module->id = 0;
$module->user = 0;
}
}
}
// get the user and configuration object
$user = &JFactory::getUser();
$conf = &JFactory::getConfig();
// set the module content
if (!is_null($content)) {
$module->content = $content;
}
//get module parameters
$mod_params = new JParameter($module->params);
$contents = '';
if ($mod_params->get('cache', 0) && $conf->getValue('config.caching'))
{
$cache = &JFactory::getCache($module->module);
$cache->setLifeTime($mod_params->get('cache_time', $conf->getValue('config.cachetime') * 60));
$contents = $cache->get(array('JModuleHelper', 'renderModule'), array($module, $params), $module->id. $user->get('aid', 0).md5(JRequest::getURI()));
}
else {
$contents = JModuleHelper::renderModule($module, $params);
}
return $contents;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />