Tpl: add var_dump function
This commit is contained in:
parent
d304d4741f
commit
98f61c36eb
1 changed files with 13 additions and 0 deletions
13
src/Tpl.php
13
src/Tpl.php
|
@ -172,6 +172,8 @@ class Tpl {
|
||||||
|
|
||||||
foreach(App :: get('templates.static_directories', array(), 'array') as $path)
|
foreach(App :: get('templates.static_directories', array(), 'array') as $path)
|
||||||
self :: register_static_directory($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']);
|
$url = self :: static_url($params['path']);
|
||||||
if ($url) echo $url;
|
if ($url) echo $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smarty function to dump variable using var_dump()
|
||||||
|
* @param array<string,mixed> $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']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue