Fix up plugin inclusion.

This commit is contained in:
andrey
2002-02-05 19:05:39 +00:00
parent 4951193444
commit 9b23c3f6d5
4 changed files with 20 additions and 16 deletions

View File

@@ -44,7 +44,7 @@
// if not defined, include_path will be used. // if not defined, include_path will be used.
if (!defined('SMARTY_DIR')) { if (!defined('SMARTY_DIR')) {
define('SMARTY_DIR', ''); define('SMARTY_DIR', dirname(__FILE__) . '/');
} }
define('SMARTY_PHP_PASSTHRU', 0); define('SMARTY_PHP_PASSTHRU', 0);
@@ -64,7 +64,8 @@ class Smarty
var $template_dir = './templates'; // name of directory for templates var $template_dir = './templates'; // name of directory for templates
var $compile_dir = './templates_c'; // name of directory for compiled templates var $compile_dir = './templates_c'; // name of directory for compiled templates
var $config_dir = './configs'; // directory where config files are located var $config_dir = './configs'; // directory where config files are located
var $plugins_dir = './plugins'; // directory where plugins are kept var $plugins_dir = 'plugins'; // directory where plugins are kept
// (relative to Smarty directory)
var $debugging = false; // enable debugging console true/false var $debugging = false; // enable debugging console true/false
var $debug_tpl = 'file:debug.tpl'; // path to debug console template var $debug_tpl = 'file:debug.tpl'; // path to debug console template

View File

@@ -167,11 +167,6 @@ class Smarty_Compiler extends Smarty {
$template_compiled, 1); $template_compiled, 1);
} }
// put header at the top of the compiled template
$template_header = "<?php /* Smarty version ".$this->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
$template_header .= " compiled from ".$tpl_file." */ ?>\n";
$template_compiled = $template_header.$template_compiled;
// remove \n from the end of the file, if any // remove \n from the end of the file, if any
if ($template_compiled{strlen($template_compiled) - 1} == "\n" ) { if ($template_compiled{strlen($template_compiled) - 1} == "\n" ) {
$template_compiled = substr($template_compiled, 0, -1); $template_compiled = substr($template_compiled, 0, -1);
@@ -189,6 +184,10 @@ class Smarty_Compiler extends Smarty {
} }
} }
// put header at the top of the compiled template
$template_header = "<?php /* Smarty version ".$this->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
$template_header .= " compiled from ".$tpl_file." */ ?>\n";
/* Emit code to load needed plugins. */ /* Emit code to load needed plugins. */
if (count($this->_plugin_info)) { if (count($this->_plugin_info)) {
$plugins_code = '<?php $this->_load_plugins(array('; $plugins_code = '<?php $this->_load_plugins(array(';
@@ -198,10 +197,12 @@ class Smarty_Compiler extends Smarty {
} }
} }
$plugins_code .= ")); ?>"; $plugins_code .= ")); ?>";
$template_compiled = $plugins_code . $template_compiled; $template_header .= $plugins_code;
$this->_plugin_info = array(); $this->_plugin_info = array();
} }
$template_compiled = $template_header . $template_compiled;
return true; return true;
} }

View File

@@ -44,7 +44,7 @@
// if not defined, include_path will be used. // if not defined, include_path will be used.
if (!defined('SMARTY_DIR')) { if (!defined('SMARTY_DIR')) {
define('SMARTY_DIR', ''); define('SMARTY_DIR', dirname(__FILE__) . '/');
} }
define('SMARTY_PHP_PASSTHRU', 0); define('SMARTY_PHP_PASSTHRU', 0);
@@ -64,7 +64,8 @@ class Smarty
var $template_dir = './templates'; // name of directory for templates var $template_dir = './templates'; // name of directory for templates
var $compile_dir = './templates_c'; // name of directory for compiled templates var $compile_dir = './templates_c'; // name of directory for compiled templates
var $config_dir = './configs'; // directory where config files are located var $config_dir = './configs'; // directory where config files are located
var $plugins_dir = './plugins'; // directory where plugins are kept var $plugins_dir = 'plugins'; // directory where plugins are kept
// (relative to Smarty directory)
var $debugging = false; // enable debugging console true/false var $debugging = false; // enable debugging console true/false
var $debug_tpl = 'file:debug.tpl'; // path to debug console template var $debug_tpl = 'file:debug.tpl'; // path to debug console template

View File

@@ -167,11 +167,6 @@ class Smarty_Compiler extends Smarty {
$template_compiled, 1); $template_compiled, 1);
} }
// put header at the top of the compiled template
$template_header = "<?php /* Smarty version ".$this->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
$template_header .= " compiled from ".$tpl_file." */ ?>\n";
$template_compiled = $template_header.$template_compiled;
// remove \n from the end of the file, if any // remove \n from the end of the file, if any
if ($template_compiled{strlen($template_compiled) - 1} == "\n" ) { if ($template_compiled{strlen($template_compiled) - 1} == "\n" ) {
$template_compiled = substr($template_compiled, 0, -1); $template_compiled = substr($template_compiled, 0, -1);
@@ -189,6 +184,10 @@ class Smarty_Compiler extends Smarty {
} }
} }
// put header at the top of the compiled template
$template_header = "<?php /* Smarty version ".$this->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
$template_header .= " compiled from ".$tpl_file." */ ?>\n";
/* Emit code to load needed plugins. */ /* Emit code to load needed plugins. */
if (count($this->_plugin_info)) { if (count($this->_plugin_info)) {
$plugins_code = '<?php $this->_load_plugins(array('; $plugins_code = '<?php $this->_load_plugins(array(';
@@ -198,10 +197,12 @@ class Smarty_Compiler extends Smarty {
} }
} }
$plugins_code .= ")); ?>"; $plugins_code .= ")); ?>";
$template_compiled = $plugins_code . $template_compiled; $template_header .= $plugins_code;
$this->_plugin_info = array(); $this->_plugin_info = array();
} }
$template_compiled = $template_header . $template_compiled;
return true; return true;
} }