'Novaconium Edit Page', 'pageclass' => 'novaconium' ]); // Check if logged in if (empty($session->get('username'))) { $messages->error('You are not logged in'); $redirect->url('/novaconium/login'); makeitso(); } // Get page ID from router parameters $pageid = $router->parameters['id'] ?? null; if (!empty($pageid)) { // Existing page: fetch from database $query = <<getRow($query, [$pageid]); // If no row is found, treat as new page if (!$data['rows']) { $pageid = null; } } if (empty($pageid)) { // New page: set default values for all fields $data['rows'] = [ 'id' => '', 'title' => '', 'heading' => '', 'description' => '', 'keywords' => '', 'author' => $session->get('username') ?? '', 'slug' => '', 'path' => '', 'intro' => '', 'body' => '', 'notes' => '', 'draft' => 0, 'changefreq' => 'monthly', 'priority' => 0.0, 'created' => date('Y-m-d H:i:s'), 'updated' => date('Y-m-d H:i:s') ]; } // Render the edit page view view('@novacore/editpage', $data);