Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /joomla/document/html/renderer/module.php

Documentation is available at module.php

  1. <?php
  2. /**
  3. @version        $Id: module.php 6673 2007-02-19 05:12:48Z louis $
  4. @package        Joomla.Framework
  5. @subpackage    Document
  6. @copyright    Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
  7. @license        GNU/GPL, see LICENSE.php
  8. *  Joomla! is free software. This version may have been modified pursuant
  9. *  to the GNU General Public License, and as distributed it includes or
  10. *  is derivative of works licensed under the GNU General Public License or
  11. *  other free or open source software licenses.
  12. *  See COPYRIGHT.php for copyright notices and details.
  13. */
  14.  
  15. // Check to ensure this file is within the rest of the framework
  16. defined('JPATH_BASE'or die();
  17.  
  18. /**
  19.  * JDocument Module renderer
  20.  *
  21.  * @author        Johan Janssens <[email protected]>
  22.  * @package        Joomla.Framework
  23.  * @subpackage    Document
  24.  * @since        1.5
  25.  */
  26. {
  27.     /**
  28.      * Renders a module script and returns the results as a string
  29.      *
  30.      * @access public
  31.      * @param string     $name        The name of the module to render
  32.      * @param array     $params        Associative array of values
  33.      * @return string    The output of the script
  34.      */
  35.     function render$module$params array()$content null )
  36.     {
  37.         if (!is_object($module))
  38.         {
  39.             $module =JModuleHelper::getModule($module);
  40.  
  41.             if (!is_object($module))
  42.             {
  43.                 if (is_null($content)) {
  44.                     return '';
  45.                 else {
  46.                     /**
  47.                      * If module isn't found in the database but data has been pushed in the buffer
  48.                      * we want to render it
  49.                      */
  50.                     $tmp $module;
  51.                     $module new stdClass();
  52.                     $module->params null;
  53.                     $module->module $tmp;
  54.                     $module->id 0;
  55.                     $module->user 0;
  56.                 }
  57.             }
  58.         }
  59.  
  60.         // get the user and configuration object
  61.         $user =JFactory::getUser();
  62.         $conf =JFactory::getConfig();
  63.  
  64.         // set the module content
  65.         if (!is_null($content)) {
  66.             $module->content $content;
  67.         }
  68.  
  69.         //get module parameters
  70.         $mod_params new JParameter$module->params );
  71.  
  72.         $cache =JFactory::getCache$module->module );
  73.  
  74.         $cache->setCaching$mod_params->get'cache'&& $conf->getValue'config.caching' ) );
  75.         $cache->setLifeTime$mod_params->get'cache_time'$conf->getValue'config.cachetime' ) ) );
  76.         $cache->setCacheValidation(true);
  77.  
  78.         return $cache->getarray('JModuleHelper''renderModule')array$module$params )$module->id$user->get('aid'0) );
  79.     }
  80. }
  81. ?>

Documentation generated on Mon, 05 Mar 2007 21:11:16 +0000 by phpDocumentor 1.3.1