// adding plugins 'implode' in Smarty tool

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11180 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-12-13 14:01:16 +00:00
parent 39edd1f064
commit 71fcbec454

View File

@@ -0,0 +1,38 @@
<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {implode} plugin
*
* Type: function<br>
* Name: implode<br>
* 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']);
}
?>