From fb35e90281096ee56b611f69ca70ee6f2f69923e Mon Sep 17 00:00:00 2001 From: lLefevre Date: Tue, 13 Dec 2011 14:01:16 +0000 Subject: [PATCH] // adding plugins 'implode' in Smarty tool --- tools/smarty/plugins/function.implode.php | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tools/smarty/plugins/function.implode.php diff --git a/tools/smarty/plugins/function.implode.php b/tools/smarty/plugins/function.implode.php new file mode 100644 index 000000000..44babfd86 --- /dev/null +++ b/tools/smarty/plugins/function.implode.php @@ -0,0 +1,38 @@ + + * Name: implode
+ * Purpose: implode Array + * Use: {implode value="" separator=""} + * + * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch} + * (Smarty online manual) + * + * @param array $params parameters + * @param Smarty_Internal_Template $template template object + * @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable + */ +function smarty_function_implode($params, $template) +{ + if (empty($params['value'])) + { + trigger_error("[plugin] implode parameter 'value' cannot be empty", E_USER_NOTICE); + return; + } + + if (empty($params['separator'])) + $params['separator'] = ','; + + return implode($params['value'], $params['separator']); +} + +?> \ No newline at end of file