Ejemplo n.º 1
0
 /**
  * Get the path to a layout for a module
  *
  * @param   string  $module  The name of the module
  * @param   string  $layout  The name of the module layout. If alternative layout, in the form template:filename.
  *
  * @return  string  The path to the module layout
  *
  * @since   1.5
  */
 public static function getLayoutPath($module, $layout = 'default')
 {
     $template = JFactory::getApplication()->getTemplate();
     $defaultLayout = $layout;
     if (strpos($layout, ':') !== false) {
         // Get the template and file name from the string
         $temp = explode(':', $layout);
         $template = $temp[0] == '_' ? $template : $temp[0];
         $layout = $temp[1];
         $defaultLayout = $temp[1] ? $temp[1] : 'default';
     }
     // Build the template and base path for the layout
     $hPath = Helix::pluginPath() . '/html/' . $module . '/' . $layout . '.php';
     // from helix
     $tPath = JPATH_THEMES . '/' . $template . '/html/' . $module . '/' . $layout . '.php';
     $bPath = JPATH_BASE . '/modules/' . $module . '/tmpl/' . $defaultLayout . '.php';
     $dPath = JPATH_BASE . '/modules/' . $module . '/tmpl/default.php';
     // If the template has a layout override use it
     if (file_exists($tPath)) {
         return $tPath;
     } elseif (file_exists($hPath)) {
         return $hPath;
     } elseif (file_exists($bPath)) {
         return $bPath;
     } else {
         return $dPath;
     }
 }