Skip to content

Instantly share code, notes, and snippets.

@saltybeagle
Created July 17, 2014 19:02
Show Gist options
  • Save saltybeagle/a9e0b554cbb6605699f6 to your computer and use it in GitHub Desktop.
Save saltybeagle/a9e0b554cbb6605699f6 to your computer and use it in GitHub Desktop.
Savvy versioning ideas
Versioning for savvy templated projects, so template files fallback to previous versions if no newer version exists
Template directories on filesystem:
templates/jsonv1
templates/jsonv2
templates/jsonv3
$_SERVER['REQUEST_URI'] = 'v2/blah.json';
while ($version > 0) {
$savant->addTemplatePath('templates/jsonv'.$version);
$version--;
}
$paths = range(1, $version);
$paths = './templates/jsonv'.implode($paths, ':./templates/jsonv');
$savant->addTemplatePath($paths);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment