diff --git a/stubs/index.php b/stubs/index.php index 2f0e52e..ce19ae6 100644 --- a/stubs/index.php +++ b/stubs/index.php @@ -72,6 +72,21 @@ function view_file_exists($filename) return file_exists($filename); } +/** + * return appended version string with a hash for proper caching for currently installed version + * @param string $url to make cache-safe + * @return string + */ +function view_cache_safe($url) +{ + $myview = \Phalcon\DI::getDefault()->get('view'); + if (!empty($myview->product_hash)) { + return "{$url}?v={$myview->product_hash}"; + } + return $url; +} + + try { /** * Read the configuration