Skip to content

Instantly share code, notes, and snippets.

@vergissberlin
Last active December 22, 2015 22:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vergissberlin/6538464 to your computer and use it in GitHub Desktop.
Save vergissberlin/6538464 to your computer and use it in GitHub Desktop.
If you use tools like RequireJS or Modernizr in TYPO3 CMS projects, then the paths to your resources are directly in the HTML code. In this case, no version numbers are appended to the file, as it is common for TYPO3 to ensure that any changes in files are loaded from the cache. More Information about: http://www.stefanhayden.com/blog/2006/04/03…
<?php
/**
* This script is part of the TYPO3 project - inspiring people to share! *
* *
* TYPO3 is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License version 2 as published by *
* the Free Software Foundation. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
* Public License for more details. *
* */
class Tx_YourExtension_ViewHelpers_File_TimestampViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper
{
/**
* Delivers path with version number as get parameter
*
* @param string $filePath
* @return string path to the source
*/
public function render($filePath = NULL) {
if($filePath === NULL) {
$filePath = $this->renderChildren();
}
$versionNumberedFilename = t3lib_div::createVersionNumberedFilename($filePath);
return $versionNumberedFilename;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment