# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
+if (defined('S9Y_FRAMEWORK_SMARTY')) {
+ return;
+}
+@define('S9Y_FRAMEWORK_SMARTY', true);
+
/**
* Fetch a list of trackbacks for an entry
*
* groupmode (string Indicates whether the input $entries array is already grouped in preparation for the smarty $entries output array [TRUE], or if it shall be grouped by date [FALSE]
* skip_smarty_hooks (boolean) If TRUE, no plugins will be executed at all
* skip_smarty_hook (mixed) Can be set to an array of plugin hooks to NOT execute
+ * prevent_reset (boolean) If set to TRUE, the smarty $entries array will NOT be cleared. (to prevent possible duplicate output of entries)
* @param object Smarty object
* @return string The Smarty HTML response
*/
$params['skip_smarty_hook'] = array();
}
+ if (empty($params['prevent_reset'])) {
+ $params['prevent_reset'] = false;
+ }
+
// Some functions deal with the $serendipity array. To modify them, we need to store
// their original contents.
$old_var = array();
$entry, // Entry data
(!empty($params['id']) ? true : false), // Extended data?
$params['preview'], // Entry preview?
+ 'ENTRIES',
false, // Prevent Smarty parsing
$params['use_hooks'],
$params['use_footer'],
- ($params['groupmode'] == 'date' ? true : false) // Grouping of $entry
+ ($params['groupmode'] == 'date' ? false : true) // Grouping of $entry
);
// Restore the $serendipity array after our modifications.
}
$out = serendipity_smarty_fetch($params['block'], $params['template']);
-
+ // Reset array list, because we might be in a nested code call.
+ if ($params['prevent_reset'] == false) {
+ $serendipity['smarty']->assign('entries', array());
+ }
$serendipity['skip_smarty_hook'] = $old_var['skip_smarty_hook'];
$serendipity['skip_smarty_hooks'] = $old_var['skip_smarty_hooks'];
if (!isset($serendipity['smarty'])) {
@define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
- require_once SMARTY_DIR . 'Smarty.class.php';
+ if (!class_exists('Smarty')) {
+ require SMARTY_DIR . 'Smarty.class.php';
+ }
$serendipity['smarty'] = new Smarty;
if ($serendipity['production'] === 'debug') {
$serendipity['smarty']->force_compile = true;
// For advanced usage, we allow template authors to create a file 'config.inc.php' where they can
// setup custom smarty variables, modifiers etc. to use in their templates.
- @include_once $serendipity['smarty']->config_dir . '/config.inc.php';
+ @include $serendipity['smarty']->config_dir . '/config.inc.php';
return true;
}