diff --git a/web/src/_templates/pub/header.php b/web/src/_templates/pub/header.php index 8a1a78b..6af2ea5 100644 --- a/web/src/_templates/pub/header.php +++ b/web/src/_templates/pub/header.php @@ -9,6 +9,7 @@ --> + diff --git a/web/src/base.php b/web/src/base.php index ebc5398..474c154 100644 --- a/web/src/base.php +++ b/web/src/base.php @@ -15,19 +15,30 @@ function tpl($ns, $args=[]) { } } -function tpl_script($script) { +function tpl_file($name, $dir, $ext) { $suffix = ''; - $script = str_replace('.', '/', $script); + $name = str_replace('.', '/', $name); if (getenv('env') === DEV) $suffix = '?_='.microtime(); - echo APP_DIR.'/js/'.$script.'.js'.$suffix; + return APP_DIR.'/'.$dir.'/'.$name.'.'.$ext.$suffix; } + +function tpl_script($script) { echo tpl_file($script, 'js', 'js'); } function tpl_scripts($scripts) { + if ($scripts === null) $scripts = []; foreach ($scripts as $script) { ?>