API15

Difference between revisions of "JDocumentRendererModule/render"

From Joomla! Documentation

< API15: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 (preparing for archive only)
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JDocumentRendererModule/render|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JDocumentRendererModule/render}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 93: Line 93:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JDocumentRendererModule/render|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JDocumentRendererModule/render}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
<CodeExamplesForm />
+
=== Code Examples ===
 
<dpl>
 
<dpl>
 
  noresultsheader=\n
 
  noresultsheader=\n
 
  category=render
 
  category=render
 
  category=JDocumentRendererModule
 
  category=JDocumentRendererModule
  category=CodeExample
+
  namespace=CodeExample
 
  category=MethodExample
 
  category=MethodExample
 
  include=*
 
  include=*
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API15]]

Latest revision as of 19:32, 24 March 2017

The "API15" 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]

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 ) );
                $cache->setCacheValidation(true);

                $contents =  $cache->get( array('JModuleHelper', 'renderModule'), array( $module, $params ), $module->id. $user->get('aid', 0) );
        } else {
                $contents = JModuleHelper::renderModule($module, $params);
        }

        return $contents;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]