diff --git a/src/Tpl.php b/src/Tpl.php index 1411b46..db81899 100644 --- a/src/Tpl.php +++ b/src/Tpl.php @@ -172,6 +172,8 @@ class Tpl { foreach(App :: get('templates.static_directories', array(), 'array') as $path) self :: register_static_directory($path); + + self :: register_function('var_dump', array('EesyPHP\\Tpl', 'smarty_var_dump')); } } @@ -698,4 +700,15 @@ class Tpl { $url = self :: static_url($params['path']); if ($url) echo $url; } + + /** + * Smarty function to dump variable using var_dump() + * @param array $params Parameters from template file + * @param Smarty $smarty The smarty object + * @return void + */ + public static function smarty_var_dump($params, $smarty) { + if (!isset($params['data'])) return; + var_dump($params['data']); + } }