Dotclear


Ignore:
Timestamp:
03/25/13 04:31:18 (12 years ago)
Author:
JcDenis
Branch:
twig
Message:

Yet another more flexible method to create template environment and context.

Location:
inc/public
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inc/public/lib.urlhandlers.php

    r779 r1128  
    8686               $_ctx->nb_entry_per_page = $core->blog->settings->system->nb_post_per_page; 
    8787          } 
     88           
     89          // Break public template here for now  
     90          // just to check if template engine is well loaded. 
     91          $core->tpl->display($tpl.'.twig'); 
     92          // To be continued... 
    8893           
    8994          $tpl_file = $core->tpl->getFilePath($tpl); 
  • inc/public/prepend.php

    r921 r1128  
    5555} catch (Exception $e) {} 
    5656 
     57# Add public default templates path 
     58$core->tpl->getLoader()->addPath(dirname(__FILE__).'/default-templates'); 
     59# Set public context 
     60$_ctx = new dcPublicContext($core); 
     61$core->tpl->addExtension($_ctx); 
     62 
     63/* 
    5764# Creating template context 
    5865$_ctx = new context(); 
     
    6471          ,640); 
    6572} 
    66  
     73*/ 
    6774# Loading locales 
    6875$_lang = $core->blog->settings->system->lang; 
     
    120127 
    121128# --BEHAVIOR-- publicPrepend 
    122 $core->callBehavior('publicPrepend',$core); 
     129$core->callBehavior('publicPrepend',$core,$_ctx); 
    123130 
    124131# Prepare the HTTP cache thing 
     
    127134$mod_ts[] = $core->blog->upddt; 
    128135 
     136 
     137# Add parent theme path 
     138if ($__parent_theme && is_dir($core->blog->themes_path.'/'.$__parent_theme.'/tpl')) { 
     139     $core->tpl->getLoader()->addPath($core->blog->themes_path.'/'.$__parent_theme.'/tpl'); 
     140} 
     141# Add theme path at the begining of path list 
     142if (is_dir($core->blog->themes_path.'/'.$__theme.'/tpl')) { 
     143     $core->tpl->getLoader()->prependPath($core->blog->themes_path.'/'.$__theme.'/tpl'); 
     144} 
     145/* 
    129146$__theme_tpl_path = array( 
    130147     $core->blog->themes_path.'/'.$__theme.'/tpl' 
     
    138155     dirname(__FILE__).'/default-templates', 
    139156     $core->tpl->getPath()); 
    140  
     157*/ 
    141158$core->url->mode = $core->blog->settings->system->url_scan; 
    142159 
Note: See TracChangeset for help on using the changeset viewer.

Sites map