1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-31 18:30:20 +02:00

PagesPlugin: add ability to get content for specific page.

This commit is contained in:
Awilum
2012-12-09 18:41:14 +02:00
parent 01e2497ff3
commit 0fca7a3153

View File

@@ -256,8 +256,28 @@
*
* @return string
*/
public static function content() {
return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
public static function content($slug = '') {
if ( ! empty($slug)) {
$page = Table::factory('pages')->select('[slug="'.$slug.'"]', null);
if ( ! empty($page)) {
$content = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt'));
$content = Filter::apply('content', $content);
return $content;
} else {
return '';
}
} else {
return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
}
}
@@ -317,7 +337,7 @@
/**
* Page class
*/
class Page extends Pages {
class Page extends Pages {
/**