mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-08 06:06:53 +02:00
#431 general structure changes
This commit is contained in:
@@ -77,7 +77,6 @@ class Monstra extends Container
|
|||||||
return new Pages($c);
|
return new Pages($c);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$container['themes'] = function ($c) {
|
$container['themes'] = function ($c) {
|
||||||
return new Themes($c);
|
return new Themes($c);
|
||||||
};
|
};
|
||||||
@@ -104,7 +103,8 @@ class Monstra extends Container
|
|||||||
// Set default timezone
|
// Set default timezone
|
||||||
date_default_timezone_set($this['config']->get('site.timezone'));
|
date_default_timezone_set($this['config']->get('site.timezone'));
|
||||||
|
|
||||||
$this['themes']->renderTemplate($this['pages']->getPage(\Url::getUriString()));
|
// Render page
|
||||||
|
$this['pages']->renderPage($this['pages']->getPage(\Url::getUriString()));
|
||||||
|
|
||||||
// Flush (send) the output buffer and turn off output buffering
|
// Flush (send) the output buffer and turn off output buffering
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
|
@@ -98,6 +98,22 @@ class Page
|
|||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render page
|
||||||
|
*/
|
||||||
|
public function renderPage($page)
|
||||||
|
{
|
||||||
|
if (empty($page['template'])) {
|
||||||
|
$template_name = 'index';
|
||||||
|
} else {
|
||||||
|
$template_name = $page['template'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$template_ext = '.php';
|
||||||
|
|
||||||
|
include THEMES_PATH . '/' . $this->monstra['config']->get('site.theme') . '/' . $template_name . $template_ext;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page parser
|
* Page parser
|
||||||
*/
|
*/
|
||||||
|
@@ -1,9 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Monstra;
|
namespace Monstra;
|
||||||
|
|
||||||
use Url;
|
|
||||||
use Response;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is part of the Monstra.
|
* This file is part of the Monstra.
|
||||||
*
|
*
|
||||||
@@ -28,17 +25,4 @@ class Themes
|
|||||||
$this->monstra = $c;
|
$this->monstra = $c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderTemplate($page)
|
|
||||||
{
|
|
||||||
if (empty($page['template'])) {
|
|
||||||
$template_name = 'index';
|
|
||||||
} else {
|
|
||||||
$template_name = $page['template'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$template_ext = '.php';
|
|
||||||
|
|
||||||
include THEMES_PATH . '/' . $this->monstra['config']->get('site.theme') . '/' . $template_name . $template_ext;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user