Changeset 2713


Ignore:
Timestamp:
Oct 11, 2008, 2:57:31 PM (16 years ago)
Author:
patdenice
Message:

Merge from trunk 2712:

  • Add known_template function (maybe we can change function name).
  • Template extensions are working with menubar blocks templates.
Location:
branches/2.0
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/admin/extend_for_templates.php

    r2588 r2713  
    7474/* Link all supported templates to their respective handle */
    7575$eligible_templates = array(
    76     '----------'              => 'N/A',
    77     'about.tpl'               => 'about',
    78     'identification.tpl'      => 'identification',
    79     'mainpage_categories.tpl' => 'index_category_thumbnails',
    80     'thumbnails.tpl'          => 'index_thumbnails',
    81     'redirect.tpl'            => 'redirect',
    82  // 'menubar.tpl'             => 'menubar', // TODO by blocks
    83     'header.tpl'              => 'header',
    84     'footer.tpl'              => 'tail',
    85     'index.tpl'               => 'index',
    86     'nbm.tpl'                 => 'nbm',
    87     'notification.tpl'        => 'notification',
    88     'picture_content.tpl'     => 'default_content',
    89     'picture.tpl'             => 'picture',
    90     'popuphelp.tpl'           => 'popuphelp',
    91     'profile.tpl'             => 'profile',
    92     'profile_content.tpl'     => 'profile_content',
    93     'register.tpl'            => 'register',
    94     'search.tpl'              => 'search',
    95     'search_rules.tpl'        => 'search_rules',
    96     'slideshow.tpl'           => 'slideshow',
    97     'tags.tpl'                => 'tags',
    98     'upload.tpl'              => 'upload',);
     76    '----------'                 => 'N/A',
     77    'about.tpl'                  => 'about',
     78    'identification.tpl'         => 'identification',
     79    'mainpage_categories.tpl'    => 'index_category_thumbnails',
     80    'thumbnails.tpl'             => 'index_thumbnails',
     81    'redirect.tpl'               => 'redirect',
     82    'menubar.tpl'                => 'menubar',
     83    'menubar_categories.tpl'     => 'mbCategories',
     84    'menubar_identification.tpl' => 'mbIdentification',
     85    'menubar_links.tpl'          => 'mbLinks',
     86    'menubar_menu.tpl'           => 'mbMenu',
     87    'menubar_specials.tpl'       => 'mbSpecials',
     88    'menubar_tags.tpl'           => 'mbTags',
     89    'header.tpl'                 => 'header',
     90    'footer.tpl'                 => 'tail',
     91    'index.tpl'                  => 'index',
     92    'nbm.tpl'                    => 'nbm',
     93    'notification.tpl'           => 'notification',
     94    'picture_content.tpl'        => 'default_content',
     95    'picture.tpl'                => 'picture',
     96    'popuphelp.tpl'              => 'popuphelp',
     97    'profile.tpl'                => 'profile',
     98    'profile_content.tpl'        => 'profile_content',
     99    'register.tpl'               => 'register',
     100    'search.tpl'                 => 'search',
     101    'search_rules.tpl'           => 'search_rules',
     102    'slideshow.tpl'              => 'slideshow',
     103    'tags.tpl'                   => 'tags',
     104    'upload.tpl'                 => 'upload',);
    99105  $flip_templates = array_flip($eligible_templates);
    100106// +-----------------------------------------------------------------------+
  • branches/2.0/include/template.class.php

    r2699 r2713  
    6767    $this->smarty->register_block('html_head', array(&$this, 'block_html_head') );
    6868    $this->smarty->register_function('known_script', array(&$this, 'func_known_script') );
     69    $this->smarty->register_function('known_template', array(&$this, 'func_known_template') );
    6970    $this->smarty->register_prefilter( array('Template', 'prefilter_white_space') );
    7071    if ( $conf['compiled_template_cache_language'] )
     
    409410  }
    410411
     412 /**
     413   * This smarty "known_template" functions allows to include template
     414   * If extent[$params['id']] exists, include template extension
     415   * else include $params[$file]
     416   */ 
     417  function func_known_template($params, &$smarty )
     418  {
     419    if (!isset($params['file']))
     420    {
     421      $smarty->trigger_error("known_template: missing 'file' parameter");
     422      return;
     423    }
     424
     425    if (isset($params['id']) and isset($this->extents[$params['id']]))
     426    {
     427      $file = $this->extents[$params['id']];
     428    }
     429    else
     430    {
     431      $file = $params['file'];
     432    }
     433
     434    return $smarty->_smarty_include(array(
     435             'smarty_include_tpl_file' => $file,
     436             'smarty_include_vars' => array()
     437             ));
     438  }
     439
    411440  static function prefilter_white_space($source, &$smarty)
    412441  {
  • branches/2.0/plugins/LocalFilesEditor/admin.php

    r2588 r2713  
    185185          'thumbnails.tpl',
    186186          'redirect.tpl',
    187           // 'menubar.tpl'
     187          'menubar.tpl',
     188          'menubar_categories.tpl',
     189          'menubar_identification.tpl',
     190          'menubar_links.tpl',
     191          'menubar_menu.tpl',
     192          'menubar_specials.tpl',
     193          'menubar_tags.tpl',
    188194          'header.tpl',
    189195          'footer.tpl',
  • branches/2.0/template/yoga/menubar.tpl

    r2711 r2713  
    55        <dl id="{$id}">
    66                {if not empty($block->template)}
    7                 {include file=$block->template }
     7                {known_template id=$id file=$block->template }
    88                {else}
    99                {$block->raw_content|@default}
Note: See TracChangeset for help on using the changeset viewer.