Tiger_View_Helper_Asset

@api · extends Zend_View_Helper_Abstract

Tiger_View_Helper_Asset — cache-busting asset URLs.

Appends a filemtime()-based query token so browsers pick up changed CSS/JS after a deploy without a hard refresh. Design notes:

  • Zero-build. The token is the file's mtime — no manifest, no content-hash rename, no npm. Per-file precise: only files that actually changed get a new URL.
  • Query string, not a versioned path. /_theme/app.css?v=1713900000, not app.1713900000.css. So it needs NO server rewrite and can't 404 — portable across Apache / nginx / Caddy / shared hosting. (Path-fingerprint mode, with a rewrite, would only matter for a dumb query-stripping CDN — deferred.)
  • Feature-flagged. tiger.assets.cache_bust (config, default on, live- overridable per-deploy/org) turns it off — then paths pass through untouched.
  • Graceful. Remote URLs, protocol-relative, data URIs, and missing files pass through unchanged. mtime lookups are memoized per request.

    $this->asset($this->themeAssets . '/css/default.css') // → /_theme/css/default.css?v=1713900000

Methods

asset()

asset($path)

Append a cache-busting ?v=<filemtime> token to a local asset path.

Remote/protocol-relative/empty paths, and paths whose file can't be stat'd, pass through unchanged. Results are memoized per request.

  • $path string — the root-relative asset path (e.g. /_theme/css/app.css)

Returns string — the versioned URL, or the original path when it can't be versioned