Move default template
This commit is contained in:
parent
d575f3d890
commit
6c14601ff3
18 changed files with 10 additions and 9 deletions
|
@ -38,11 +38,11 @@ class Cache {
|
|||
* @param array $params An associative array
|
||||
* @return bool Returns true if the cached page is still valid; otherwise, false
|
||||
*/
|
||||
static function isValidPage(array $params): bool {
|
||||
static function isValidPage(array $params, string $theme): bool {
|
||||
$mdModifiedTime = 0;
|
||||
// @todo add test if file exist
|
||||
if ($params['type'] === 'home') {
|
||||
$mdModifiedTime = filemtime(self::$templateDir . '/home.php');
|
||||
$mdModifiedTime = filemtime(self::$templateDir . '/'.$theme.'/home.php');
|
||||
} elseif ($params['type'] === 'post') {
|
||||
$postList = new Blogs($params);
|
||||
$postAttr = $postList->returnPostInfo($params['slug']);
|
||||
|
|
|
@ -81,7 +81,7 @@ class Dev {
|
|||
$postRegenCache = 'Post : regen';
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../template/dev.php';
|
||||
require __DIR__ . '/../../template/'.$params['config']['theme'].'/dev.php';
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $content;
|
||||
|
|
|
@ -78,7 +78,7 @@ class Home {
|
|||
$homeContent = preg_replace("/<% lastAppsUpdates %>/", $lastAppsUpdates, $homeContent);
|
||||
$homeContent = preg_replace("/<% lastPics %>/", $lastPics, $homeContent);
|
||||
|
||||
require __DIR__ . '/../../template/home.php';
|
||||
require __DIR__ . '/../../template/'.$params['config']['theme'].'/home.php';
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $content;
|
||||
|
|
|
@ -32,7 +32,7 @@ class Page {
|
|||
|
||||
$pageContent = RenderHtml::markdownToHtml($pageContent);
|
||||
|
||||
require __DIR__ . '/../../template/page.php';
|
||||
require __DIR__ . '/../../template/'.$params['config']['theme'].'/page.php';
|
||||
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
|
|
@ -26,7 +26,7 @@ class Post {
|
|||
$this->title = $postInfo['title'];
|
||||
$author = $params['config']['author'];
|
||||
|
||||
require __DIR__ . '/../../template/post.php';
|
||||
require __DIR__ . '/../../template/'.$params['config']['theme'].'/post.php';
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $content;
|
||||
|
|
|
@ -39,7 +39,7 @@ class Posts {
|
|||
$getPostList = $posts->getFilesForPage($params['page']);
|
||||
$pagination = $posts->makePagination($params['page']);
|
||||
|
||||
require __DIR__ . '/../../template/posts.php';
|
||||
require __DIR__ . '/../../template/'.$params['config']['theme'].'/posts.php';
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $content;
|
||||
|
|
|
@ -90,7 +90,7 @@ class Router {
|
|||
$content = call_user_func_array(array($controller_instance, 'index'), $params);
|
||||
$title = $controller_instance->title();
|
||||
ob_start();
|
||||
require_once __DIR__ . '/../template/bone.php';
|
||||
require_once __DIR__ . '/../template/'.$params[0]['config']['theme'].'/bone.php';
|
||||
|
||||
$contentFinal = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
|
|
@ -7,6 +7,7 @@ class Config {
|
|||
'siteName' => 'My super page',
|
||||
'author' => 'Me !!!',
|
||||
'useCache' => false,
|
||||
'theme' => 'default',
|
||||
'postPerPage' => 5,
|
||||
'numberOfLastItem' => 5,
|
||||
'debug' => false,
|
||||
|
|
|
@ -45,7 +45,7 @@ if (isset($match['params']['extraParams']['live']) && $match['params']['extraPar
|
|||
}
|
||||
|
||||
if ($match) {
|
||||
if (Cache::isCache($match['params']) && Cache::isValidPage($match['params']) && Cache::isValidConfig() && $config['useCache'] === true) {
|
||||
if (Cache::isCache($match['params']) && Cache::isValidPage($match['params'], $config['theme']) && Cache::isValidConfig() && $config['useCache'] === true) {
|
||||
$gen = Cache::getCache($match['params']['cacheName'], $match['params']['type']);
|
||||
$genType = 'Serve from cache in : ';
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue