summaryrefslogtreecommitdiff
path: root/web/_model
diff options
context:
space:
mode:
Diffstat (limited to 'web/_model')
-rw-r--r--web/_model/main.php16
1 files changed, 14 insertions, 2 deletions
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
@@ -48,11 +48,22 @@ 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 '<link rel="stylesheet" href="/public/' . $path . '">';
+ $stamp = $this->asset_stamp($path);
+ return '<link rel="stylesheet" href="/public/' . $path . '?stamp=' . $stamp . '">';
}
/**
@@ -60,7 +71,8 @@ class Main_model {
* @param string $path - the path to the js file
*/
public function link_js($path) {
- return '<script src="/public/'. $path . '"></script>';
+ $stamp = $this->asset_stamp($path);
+ return '<script src="/public/'. $path . '?stamp=' . $stamp . '"></script>';
}
/**