Closed aolko closed 7 years ago
Hi @aolko, in your static function dwoo($tpl, $params = [])
, the 2nd parameter $params
is never used.
You need to merge arrays such as:
$params = array_merge($params, [
'theme' => [
'path' => $dwoo_paths['tpl_path'],
'assets_path' => $dwoo_paths['theme_path'] . '/assets/'
]
]);
You will be able to access your username such as: {$userdata.username}
.
Let me know if it's OK!
that's ok, thanks, btw, how do i disble caching for specific tpl? tired of cleaning cache folder every time
You cannot disable caching, dwoo will always create caching files. If you update your template file dwoo is supposed to rebuild the cached file.
If it's not working, you can remove cached files by using some code like:
protected function clearDir($path, $emptyOnly = false)
{
if (is_dir($path)) {
foreach (glob($path . '/*') as $f) {
$this->clearDir($f);
}
if (!$emptyOnly) {
rmdir($path);
}
} elseif (is_file($path)) {
unlink($path);
}
}
sometimes cache is a bottleneck, when you have a series of rapid tpl edits, smarty had a handy cache disabling (globally and per tpl)
what exactly am i doing wrong over here? (my params won't pass externally(first snippet)) by the way, any alternative to json_decode?