Messed around a bit with the page template

This commit is contained in:
Belle Aerni 2023-01-06 17:47:03 -08:00
parent 622f99adff
commit ceea75b233
3 changed files with 25 additions and 9 deletions

View file

@ -5,6 +5,7 @@ namespace AntCMS;
use AntCMS\AntMarkdown;
use AntCMS\AntKeywords;
use AntCMS\AntPages;
use AntCMS\AntConfig;
class AntCMS
{
@ -12,6 +13,7 @@ class AntCMS
{
$start_time = microtime(true);
$content = $this->getPage($page);
$siteInfo = AntCMS::getSiteInfo();
if (!$content || !is_array($content)) {
$this->renderException("404");
@ -20,12 +22,15 @@ class AntCMS
$markdown = AntMarkdown::renderMarkdown($content['content']);
$pageTemplate = $this->getThemeContent();
$pageTemplate = str_replace('<!--AntCMS-Body-->', $markdown, $pageTemplate);
$pageTemplate = str_replace('<!--AntCMS-Title-->', $content['title'], $pageTemplate);
$pageTemplate = str_replace('<!--AntCMS-Description-->', $content['description'], $pageTemplate);
$pageTemplate = str_replace('<!--AntCMS-Author-->', $content['author'], $pageTemplate);
$pageTemplate = str_replace('<!--AntCMS-Keywords-->', $content['keywords'], $pageTemplate);
$pageTemplate = str_replace('<!--AntCMS-Title-->', $content['title'], $pageTemplate);
$pageTemplate = str_replace('<!--AntCMS-Navigation-->', AntPages::generateNavigation(null), $pageTemplate);
$pageTemplate = str_replace('<!--AntCMS-Body-->', $markdown, $pageTemplate);
$pageTemplate = str_replace('<!--AntCMS-SiteTitle-->', $siteInfo['siteTitle'], $pageTemplate);
$end_time = microtime(true);
$elapsed_time = round($end_time - $start_time, 4);
@ -129,4 +134,9 @@ class AntCMS
}
return $pageHeaders;
}
public static function getSiteInfo(){
$currentConfig = AntConfig::currentConfig();
return $currentConfig['SiteInfo'];
}
}

View file

@ -9,6 +9,9 @@ class AntConfig
public static function generateConfig()
{
$defaultOptions = array(
'SiteInfo' => array(
'siteTitle' => 'AntCMS',
),
'forceHTTPS' => true,
'activeTheme' => 'default',
'generateKeywords' => true,

View file

@ -1,24 +1,27 @@
<!doctype html>
<html lang="en">
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<!--AntCMS-Description-->">
<meta name="author" content="<!--AntCMS-Author-->">
<meta name="keywords" content="<!--AntCMS-Keywords-->">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
crossorigin="anonymous"></script>
<title><!--AntCMS-Title--></title>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">My Website</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
<nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="<!--AntCMS-SiteLink-->"><!--AntCMS-SiteTitle--></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>