Update of /cvsroot/php-blog/serendipity/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14995/include
Modified Files:
functions_smarty.inc.php
Log Message:
allow special file 'smarty.php' in template directories, where one can
setup/change special smarty variables. This is important for making embedded
mode usable to interact the existing framework with s9y.
Index: functions_smarty.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/functions_smarty.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- functions_smarty.inc.php 20 Nov 2004 19:26:43 -0000 1.5
+++ functions_smarty.inc.php 23 Nov 2004 11:37:19 -0000 1.6
@@ -108,6 +108,7 @@
global $serendipity;
if (!isset($serendipity['smarty'])) {
+ $firstcall = true;
@define('SMARTY_DIR', S9Y_INCLUDE_PATH . 'bundled-libs/Smarty/libs/');
require_once SMARTY_DIR . 'Smarty.class.php';
$serendipity['smarty'] = new Smarty;
@@ -134,6 +135,8 @@
$serendipity['smarty']->register_function('serendipity_getFile', 'serendipity_smarty_getFile');
$serendipity['smarty']->register_function('serendipity_printComments', 'serendipity_smarty_printComments');
$serendipity['smarty']->register_function('serendipity_printTrackbacks', 'serendipity_smarty_printTrackbacks');
+ } else {
+ $firstcall = false;
}
if (!isset($serendipity['smarty_raw_mode'])) {
@@ -176,6 +179,13 @@
)
);
+ if ($firstcall && file_exists($serendipity['smarty']->template_dir . '/smarty.php')) {
+ // For advanced usage, we allow template authors to create a file 'smarty.php' where they can
+ // setup custom smarty variables, modifieds etc. to use in their templates.
+ // This is especially important in embedded installations.
+ include_once $serendipity['smarty']->template_dir . '/smarty.php';
+ }
+
return true;
}
|