Changeset 2434


Ignore:
Timestamp:
Jul 14, 2008, 11:42:40 PM (16 years ago)
Author:
vdigital
Message:

Feature template-extension based on 2006 chrisaga's idea.
chrisaga wrote: "If you want to make some template customization without building a brand new
template, you should use ..."

Location:
trunk
Files:
10 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin.php

    r2342 r2434  
    7979    'U_CONFIG_GENERAL'=> $link_start.'configuration',
    8080    'U_CONFIG_DISPLAY'=> $conf_link.'default',
     81    'U_CONFIG_EXTENTS'=> $link_start.'extend_for_templates',
    8182    'U_CATEGORIES'=> $link_start.'cat_list',
    8283    'U_MOVE'=> $link_start.'cat_move',
  • trunk/admin/template/yoga/admin.tpl

    r2426 r2434  
    2424        <li><a href="{$U_CONFIG_GENERAL}">{'conf_general'|@translate}</a></li>
    2525        <li><a href="{$U_CONFIG_DISPLAY}">{'conf_display'|@translate}</a></li>
     26        <li><a href="{$U_CONFIG_EXTENTS}">{'conf_extents'|@translate}</a></li>
    2627      </ul>
    2728    </dd>
  • trunk/admin/template/yoga/theme/admin/themeconf.inc.php

    r2390 r2434  
    99    switch ($_GET['page']) {
    1010      case 'configuration':
     11      case 'extend_for_templates':
    1112        return 1;
    1213      case 'site_manager':
  • trunk/include/template.class.php

    r2334 r2434  
    146146  function set_filenames($filename_array)
    147147  {
     148    global $conf;
    148149    if (!is_array($filename_array))
    149150    {
    150151      return false;
    151152    }
    152 
    153153    reset($filename_array);
     154    $tpl_extension = isset($conf['extents_for_templates']) ?
     155      unserialize($conf['extents_for_templates']) : array();
    154156    while(list($handle, $filename) = each($filename_array))
    155157    {
     
    157159        unset( $this->files[$handle] );
    158160      else
    159         $this->files[$handle] = $filename;
     161      {
     162        if (!isset($this->files[$handle])) $this->files[$handle] = $filename;
     163        foreach ($tpl_extension as $file => $conditions)
     164        {
     165          $localtpl = './template-extension/' . $file;
     166          if ($handle == $conditions[0] and
     167             (stripos(implode('/',array_flip($_GET)),$conditions[1])>0
     168              or $conditions[1] == 'N/A')
     169              and file_exists($localtpl))
     170          { /* examples: Are best_rated, created-monthly-calendar, list, ... set? */
     171              $this->files[$handle] = '../.' . $localtpl;
     172              /* assign their tpl-extension */
     173              /* For test purpose: Do advanced users need a php access? */
     174              // $localphp = '../.' . substr($localtpl,0,-3).'php';
     175              // if (file_exists($localphp)) @include_once($localphp);
     176          }
     177        }
     178      }
    160179    }
    161180    return true;
    162181  }
    163 
     182  function on_extension($key, $tlpname)
     183  {
     184    return $tplname;
     185  }
    164186  /** see smarty assign http://www.smarty.net/manual/en/api.assign.php */
    165187  function assign($tpl_var, $value = null)
  • trunk/language/en_UK/admin.lang.php

    r2428 r2434  
    650650$lang['Hits'] = 'Hits';
    651651$lang['GD library is missing'] = 'GD library is missing';
     652$lang['conf_extents'] = 'Templates';
     653$lang['extend_for_templates'] = 'Extend for templates';
     654$lang['Replacement of original templates'] =
     655 'Replacement of original templates by customized templates from template-extension subfolder';
     656$lang['Replacers'] = 'Replacers (customized templates)';
     657$lang['Original templates'] = 'Original templates';
     658$lang['Optional URL keyword'] = 'Optional URL keyword';
     659$lang['Templates recorded.'] = 'Templates configuration has been recorded.';
    652660?>
  • trunk/language/fr_FR/admin.lang.php

    r2428 r2434  
    650650$lang['Hits'] = 'Utilisations';
    651651$lang['GD library is missing'] = 'la bibliothèque GD est manquante';
     652$lang['conf_extents'] = 'Templates (modèles)';
     653$lang['extend_for_templates'] = 'Etendre les templates';
     654$lang['Replacement of original templates'] =
     655 'Remplacement des templates d\'origine par vos templates adaptés du dossier template-extension';
     656$lang['Replacers'] = 'Remplaçants (templates modifiés)';
     657$lang['Original templates'] = 'Templates d\'origine';
     658$lang['Optional URL keyword'] = 'Paramètre facultatif de l\'URL';
     659$lang['Templates recorded.'] = 'La configuration des templates a été enregistrée.';
    652660?>
Note: See TracChangeset for help on using the changeset viewer.