From fa77cc805bc3c4356eeff12ed6260c3e9154ad9b Mon Sep 17 00:00:00 2001 From: Kanti Date: Fri, 1 Aug 2014 13:23:14 +0200 Subject: [PATCH] Basic Support for SubPages Ready to use. Must Add CMS Funktions Add/Edit/delete to it. if Rename a Static page the subFolder must be renamed as well. --- system/admin/admin.php | 6 ++-- system/htmly.php | 26 ++++++++++++++++++ system/includes/functions.php | 64 +++++++++++++++++++++++++++++++++---------- 3 files changed, 79 insertions(+), 17 deletions(-) diff --git a/system/admin/admin.php b/system/admin/admin.php index 46e584e..48bebae 100644 --- a/system/admin/admin.php +++ b/system/admin/admin.php @@ -374,7 +374,7 @@ function get_recent_pages() { echo '' . $p->title . ''; if (config("views.counter") == "true") echo '' . $p->views . ''; - echo 'Edit Delete'; + echo 'Add Sub Edit Delete'; echo ''; $shortUrl = substr($p->url,strrpos($p->url, "/") + 1); @@ -384,8 +384,8 @@ function get_recent_pages() { { echo ''; echo ' »' . $sp->title . ''; - if (config("views.counter") == "true") - echo '' . $sp->views . ''; + if (config("views.counter") == "true") + echo '' . $sp->views . ''; echo 'Edit Delete'; echo ''; } diff --git a/system/htmly.php b/system/htmly.php index 25a5e82..e0b310a 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -108,6 +108,24 @@ post('/login', function() { } }); +get("/:static/:sub/edit", function($static,$sub){ + echo $static,$sub,"edit"; + die(); +}); +post("/:static/:sub/edit", function($static,$sub){ + echo $static,$sub,"edit."; + die(); +}); + +get("/:static/:sub/delete", function($static,$sub){ + echo $static,$sub,"delete"; + die(); +}); +post("/:static/:sub/delete", function($static,$sub){ + echo $static,$sub,"delete."; + die(); +}); + // The blog post page get('/:year/:month/:name', function($year, $month, $name) { @@ -1098,6 +1116,14 @@ get('/admin/update/now/:csrf', function($CSRF) { } }); +get('/:static/add', function($static){ + echo $static,"add"; + die(); +}); +post('/:static/add', function($static){ + echo $static,"add."; + die(); +}); get('/:static/:sub', function($static,$sub) { diff --git a/system/includes/functions.php b/system/includes/functions.php index c5ed545..e40a138 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -1082,6 +1082,22 @@ function menu() { } } +function get_title_from_file($v) +{ + // Get the contents and convert it to HTML + $content = MarkdownExtra::defaultTransform(file_get_contents($v)); + + // Extract the title and body + $arr = explode('t-->', $content); + if (isset($arr[1])) { + $title = str_replace('', $content); - if (isset($arr[1])) { - $title = str_replace('