Added Tabs to edit page
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
$data = array_merge($data, [
|
||||
'title' => 'Novaconium Edit Page',
|
||||
'pageclass' => 'novaconium'
|
||||
'pageclass' => 'novaconium',
|
||||
'editor' => 'ace'
|
||||
]);
|
||||
|
||||
// Check if logged in
|
||||
@@ -18,25 +19,35 @@ $pageid = $router->parameters['id'] ?? null;
|
||||
if (!empty($pageid)) {
|
||||
// Existing page: fetch from database
|
||||
$query = <<<EOSQL
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
heading,
|
||||
description,
|
||||
keywords,
|
||||
author,
|
||||
slug,
|
||||
path,
|
||||
intro,
|
||||
body,
|
||||
notes,
|
||||
draft,
|
||||
changefreq,
|
||||
priority,
|
||||
created,
|
||||
updated
|
||||
FROM pages
|
||||
WHERE id = ?
|
||||
WITH all_tags AS (
|
||||
SELECT GROUP_CONCAT(DISTINCT name ORDER BY name SEPARATOR ',') AS tags_list
|
||||
FROM tags
|
||||
)
|
||||
SELECT
|
||||
p.id,
|
||||
p.title,
|
||||
p.heading,
|
||||
p.description,
|
||||
p.keywords,
|
||||
p.author,
|
||||
p.slug,
|
||||
p.path,
|
||||
p.intro,
|
||||
p.body,
|
||||
p.notes,
|
||||
p.draft,
|
||||
p.changefreq,
|
||||
p.priority,
|
||||
p.created,
|
||||
p.updated,
|
||||
COALESCE(GROUP_CONCAT(DISTINCT t.name ORDER BY t.name SEPARATOR ','), '') AS page_tags,
|
||||
at.tags_list AS existing_tags
|
||||
FROM pages p
|
||||
LEFT JOIN page_tags pt ON p.id = pt.page_id
|
||||
LEFT JOIN tags t ON pt.tag_id = t.id
|
||||
CROSS JOIN all_tags at -- Zero-cost join for scalar
|
||||
WHERE p.id = ?
|
||||
GROUP BY p.id;
|
||||
EOSQL;
|
||||
|
||||
$data['rows'] = $db->getRow($query, [$pageid]);
|
||||
@@ -70,4 +81,4 @@ if (empty($pageid)) {
|
||||
}
|
||||
|
||||
// Render the edit page view
|
||||
view('@novacore/editpage', $data);
|
||||
view('@novacore/editpage/index', $data);
|
||||
|
||||
Reference in New Issue
Block a user