From b4ed7b40c5c6a22a9c165709552c5f673711bcf1 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Fri, 31 Mar 2006 18:35:24 +0000 Subject: [PATCH] Fix a bug that might prevent {serendipity_fetchPrintEntries} from correctly showing output, and maybe duplicating entry list. --- include/functions_smarty.inc.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/include/functions_smarty.inc.php b/include/functions_smarty.inc.php index da5761f..8182649 100644 --- a/include/functions_smarty.inc.php +++ b/include/functions_smarty.inc.php @@ -117,6 +117,7 @@ function serendipity_emptyPrefix($string, $prefix = ': ') { * 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 */ @@ -189,6 +190,10 @@ function serendipity_smarty_fetchPrintEntries($params, &$smarty) { $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(); @@ -257,10 +262,11 @@ function serendipity_smarty_fetchPrintEntries($params, &$smarty) { $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. @@ -275,7 +281,10 @@ function serendipity_smarty_fetchPrintEntries($params, &$smarty) { } $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']; -- 2.39.5