Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Look for a template type matching the route first*

* This means you can have alternate .json templates. template.json will be used for json requests and template.html will be used for regular requests.
  • Loading branch information...
commit c857d7d83e89dc3fc6b1e644e2316aa632f26877 1 parent c3464ea
@kolber authored
Showing with 5 additions and 2 deletions.
  1. +4 −1 app/asset-types/page.inc.php
  2. +1 −1  app/cache.inc.php
View
5 app/asset-types/page.inc.php
@@ -60,8 +60,11 @@ static function template_name($file_path) {
}
static function template_file($template_name) {
+ preg_match('/(\.[\w\d]+?)$/', $_SERVER["REQUEST_URI"], $ext);
+ $extension = isset($ext[1]) ? $ext[1] : '.*';
$template_name = preg_replace('/([^.]*\.)?([^.]*)$/', '\\2', $template_name);
- $template_file = glob(Config::$templates_folder.'/'.$template_name.'.*');
+ $template_file = glob(Config::$templates_folder.'/'.$template_name.$extension);
+ if (!isset($template_file[0])) $template_file = glob(Config::$templates_folder.'/'.$template_name.'.*');
# return template if one exists
return isset($template_file[0]) ? $template_file[0] : Config::$templates_folder.'/default.html';
}
View
2  app/cache.inc.php
@@ -9,7 +9,7 @@
function __construct($file_path, $template_file) {
# generate an md5 hash from the file_path
- $this->path_hash = $this->generate_hash($file_path);
+ $this->path_hash = $this->generate_hash($file_path.':'.$template_file);
# generate an md5 hash from the current state of the site content
$htaccess = file_exists(Config::$root_folder.'.htaccess') ? '.htaccess:'.filemtime(Config::$root_folder.'.htaccess') : '';
$file_cache = serialize(Helpers::file_cache());
Please sign in to comment.
Something went wrong with that request. Please try again.