Source for file helper.php

Documentation is available at helper.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Libraries
  4.  * @subpackage  Layout
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('JPATH_BASE'or die;
  11.  
  12. /**
  13.  * Helper to render a JLayout object, storing a base path
  14.  *
  15.  * @package     Joomla.Libraries
  16.  * @subpackage  Layout
  17.  * @see         http://docs.joomla.org/Sharing_layouts_across_views_or_extensions_with_JLayout
  18.  * @since       3.1
  19.  */
  20. {
  21.     /**
  22.      * A default base path that will be used if none is provided when calling the render method.
  23.      * Note that JLayoutFile itself will defaults to JPATH_ROOT . '/layouts' if no basePath is supplied at all
  24.      *
  25.      * @var    string 
  26.      * @since  3.1
  27.      */
  28.     public static $defaultBasePath '';
  29.  
  30.     /**
  31.      * Method to render the layout.
  32.      *
  33.      * @param   string  $layoutFile   Dot separated path to the layout file, relative to base path
  34.      * @param   object  $displayData  Object which properties are used inside the layout file to build displayed output
  35.      * @param   string  $basePath     Base path to use when loading layout files
  36.      * @param   mixed   $options      Optional custom options to load. JRegistry or array format
  37.      *
  38.      * @return  string 
  39.      *
  40.      * @since   3.1
  41.      */
  42.     public static function render($layoutFile$displayData null$basePath ''$options null)
  43.     {
  44.         $basePath empty($basePathself::$defaultBasePath $basePath;
  45.  
  46.         // Make sure we send null to JLayoutFile if no path set
  47.         $basePath empty($basePathnull $basePath;
  48.         $layout new JLayoutFile($layoutFile$basePath$options);
  49.         $renderedLayout $layout->render($displayData);
  50.  
  51.         return $renderedLayout;
  52.     }
  53. }

Documentation generated on Tue, 19 Nov 2013 15:04:26 +0100 by phpDocumentor 1.4.3