Changeset 5126


Ignore:
Timestamp:
Mar 13, 2010, 3:14:32 AM (11 years ago)
Author:
patdenice
Message:

Feature 1502
Extend for templates now work properly.
Bound template as to be renamed in bound theme...

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/extend_for_templates.php

    r5123 r5126  
    112112$available_templates = array_merge(
    113113  array('N/A' => '----------'),
    114   get_dirs(PHPWG_ROOT_PATH.'theme'));
     114  get_dirs(PHPWG_ROOT_PATH.'themes'));
    115115
    116116// +-----------------------------------------------------------------------+
  • trunk/include/template.class.php

    r5123 r5126  
    7979
    8080    $this->smarty->template_dir = array();
    81     if ( !empty($theme) )
    82     {
    83       $this->set_theme($root, $theme, $path);
    84     }
     81    $this->set_theme($root, $theme, $path);
    8582
    8683    $this->smarty->assign('lang_info', $lang_info);
     
    8986    {
    9087      $tpl_extents = unserialize($conf['extents_for_templates']);
    91       $this->set_extents($tpl_extents, './template-extension/', true);
     88      $this->set_extents($tpl_extents, './template-extension/', true, $theme);
    9289    }
    9390  }
     
    116113  }
    117114
     115  /**
     116   * Add template directory for this Template object.
     117   * Set compile id if not exists.
     118   */
    118119  function set_template_dir($dir)
    119120  {
     
    190191   * Sets template extention filename for handles.
    191192   */
    192   function set_extent($filename, $param, $dir='', $overwrite=true)
     193  function set_extent($filename, $param, $dir='', $overwrite=true, $theme='N/A')
    193194  {
    194195    return $this->set_extents(array($filename => $param), $dir, $overwrite);
     
    199200   * $filename_array should be an hash of filename => array( handle, param) or filename => handle
    200201   */
    201   function set_extents($filename_array, $dir='', $overwrite=true)
    202   {
    203     global $user;
    204 
     202  function set_extents($filename_array, $dir='', $overwrite=true, $theme='N/A')
     203  {
    205204    if (!is_array($filename_array))
    206205    {
     
    213212        $handle = $value[0];
    214213        $param = $value[1];
    215         $tpl = $value[2];
     214        $thm = $value[2];
    216215      }
    217216      elseif (is_string($value))
     
    219218        $handle = $value;
    220219        $param = 'N/A';
    221         $tpl = 'N/A';
     220        $thm = 'N/A';
    222221      }
    223222      else
     
    227226
    228227      if ((stripos(implode('',array_keys($_GET)), '/'.$param) !== false or $param == 'N/A')
    229         and ($tpl == $user['theme'] or $tpl == 'N/A')
     228        and ($thm == $theme)
    230229        and (!isset($this->extents[$handle]) or $overwrite)
    231230        and file_exists($dir . $filename))
Note: See TracChangeset for help on using the changeset viewer.