Added a way to include template args as string
This commit is contained in:
parent
5f98b94ff3
commit
e9d69b7d0f
|
@ -12,6 +12,16 @@ function urlargs($from = 0) {
|
|||
}
|
||||
|
||||
function tpl($ns, $args=[]) {
|
||||
if (gettype($args) === 'string') {
|
||||
$ps = explode('|', $args);
|
||||
$args = [];
|
||||
foreach ($ps as $p) {
|
||||
$p = trim($p);
|
||||
$k = trim(substr($p, 0, strpos($p, ':')));
|
||||
$v = trim(substr($p, strpos($p, ':')+1));
|
||||
$args[$k] = $v;
|
||||
}
|
||||
}
|
||||
$ns = str_replace('.','/',$ns);
|
||||
$__tfile = "_templates/$ns.php";
|
||||
if (file_exists($__tfile)) {
|
||||
|
|
Loading…
Reference in New Issue