From ef7b0e26fadb882e026f1b447b6d18259057c040 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 30 Mar 2024 21:28:46 -0400 Subject: refactor asset dir, refactor oberver in lib --- web/_model/main.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'web/_model') diff --git a/web/_model/main.php b/web/_model/main.php index f72a2f3..ab964fd 100644 --- a/web/_model/main.php +++ b/web/_model/main.php @@ -47,12 +47,23 @@ class Main_model { } } + /** + * Gets the stamp for a asset path + * @param string $path + */ + private function asset_stamp($path): int { + $root = $GLOBALS['webroot']; + $path = $root . '/public/' . $path; + return filemtime($path); + } + /** * Loads a css html link * @param string $path - the path to the css file */ public function link_css($path) { - return ''; + $stamp = $this->asset_stamp($path); + return ''; } /** @@ -60,7 +71,8 @@ class Main_model { * @param string $path - the path to the js file */ public function link_js($path) { - return ''; + $stamp = $this->asset_stamp($path); + return ''; } /** -- cgit v1.2.3-freya