diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-03-01 13:12:07 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-03-01 13:12:07 +0000 |
commit | 35076ee1b9e32618d3c92bdd8aee20f2c4abb694 (patch) | |
tree | 7a7ece7dcc77d5304366ea3bd456152a1285522e /include/template.class.php | |
parent | b2b00ba7be2d8b80cfa30aca624706162dcb7800 (diff) |
- index.tpl, menubar.tpl, mainpage_categories.tpl and month_calendar.tpl go smarty
- better template debugging tweak (the smarty console is shown only once at the end)
git-svn-id: http://piwigo.org/svn/trunk@2231 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/template.class.php')
-rw-r--r-- | include/template.class.php | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/include/template.class.php b/include/template.class.php index da4b69034..1afdb655c 100644 --- a/include/template.class.php +++ b/include/template.class.php @@ -223,21 +223,6 @@ class Template { */ function parse($handle, $return=false) { - return $this->_pparse_or_parse($handle, $return, false); - } - - /** - * Load the file for the handle, eventually compile the file and run the compiled - * code. This will print out the results of executing the template. - */ - function pparse($handle) - { - $this->_pparse_or_parse($handle, false, true); - } - - - /*private*/ function _pparse_or_parse($handle, $return, $immediate_display) - { if ( !isset($this->files[$handle]) ) { die("Template->parse(): Couldn't load template file for handle $handle"); @@ -253,31 +238,54 @@ class Template { if ($is_new) { - $this->smarty->assign( 'pwg_root', get_root_url() ); //deprecated $this->smarty->assign( 'ROOT_URL', get_root_url() ); - if ($immediate_display) - $this->p(); - $v = $this->smarty->fetch($this->files[$handle], null, null, $immediate_display ? true : false); - if ($immediate_display) - return; + $v = $this->smarty->fetch($this->files[$handle], null, null, false); } else { $this->_old->set_filename( $handle, $this->files[$handle] ); $v = $this->_old->parse($handle, true); } - if ($return==false) + if ($return) { - $this->output .= $v; + return $v; } - return $v; + $this->output .= $v; } - /** flushes current output */ + /** + * Load the file for the handle, eventually compile the file and run the compiled + * code. This will print out the results of executing the template. + */ + function pparse($handle) + { + $this->parse($handle, false); + echo $this->output; + $this->output=''; + + } + + + /** flushes the output */ function p() { + $start = get_moment(); + echo $this->output; $this->output=''; + + if ($this->smarty->debugging) + { + global $t2; + $this->smarty->assign( + array( + 'AAAA_DEBUG_OUTPUT_TIME__' => get_elapsed_time($start, get_moment()), + 'AAAA_DEBUG_TOTAL_TIME__' => get_elapsed_time($t2, get_moment()) + ) + ); + require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); + echo smarty_core_display_debug_console(null, $this->smarty); + } } /** @@ -315,6 +323,12 @@ class Template { $this->smarty->append( $tpl_var, $value, $merge ); } + /** see smarty get_template_vars http://www.smarty.net/manual/en/api.get_template_vars.php */ + function &get_template_vars($name=null) + { + return $this->smarty->get_template_vars( $name ); + } + /** see smarty append http://www.smarty.net/manual/en/api.clear_assign.php */ function clear_assign($tpl_var) { |