Skip to main content

Example

In the example shown here we go into how Quanta can be used. Please have understanding for the fact that we show here only the start page. For a full view of the example page, please open it in Github

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require 'vendor/autoload.php';

use Quanta\Quanta;
$quanta = new Quanta();
$quanta->redirect403();

require("inc/components.php");
require("inc/actions.php");
require("inc/routes.php");

$quanta->loadConfig(__DIR__ . "/config/config.json");
$quanta->actionHandler->init();
$quanta->processAction(true);
$quanta->prepareEnvironment()

?>
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $quanta->memory->meta["title"]; ?></title>

<!-- SEO Meta Tags -->
<meta name="description" content="<?php echo $quanta->memory->meta['meta']; ?>">
<meta name="keywords" content="<?php echo $quanta->memory->meta['keywords']; ?>">
<meta name="author" content="<?php echo $quanta->memory->meta['author']; ?>">

<!-- Open Graph Tags -->
<meta property="og:title" content="<?php echo $quanta->memory->meta['og_title']; ?>">
<meta property="og:description" content="<?php echo $quanta->memory->meta['og_description']; ?>">
<meta property="og:url" content="<?php echo $quanta->memory->meta['og_url']; ?>">
<meta property="og:image" content="<?php echo $quanta->memory->meta['og_image']; ?>">

<!-- Twitter Card Tags -->
<meta name="twitter:card" content="<?php echo $quanta->memory->meta['twitter_card']; ?>">
<meta name="twitter:title" content="<?php echo $quanta->memory->meta['twitter_title']; ?>">
<meta name="twitter:description" content="<?php echo $quanta->memory->meta['twitter_description']; ?>">
<meta name="twitter:image" content="<?php echo $quanta->memory->meta['twitter_image']; ?>">

<!-- Canonical URL -->
<link rel="canonical" href="<?php echo $quanta->memory->meta['canonical']; ?>">

<!-- Bootstrap CSS -->
<?php echo $quanta->renderAssets("link"); ?>

<!-- Code Highlight JS and Styles -->
<?php echo $quanta->renderAsset("code-highlight-js"); ?>
<?php echo $quanta->renderAsset("code-highlight-languages-js"); ?>
<script>hljs.highlightAll();</script>
</head>

<body>
<!--Navigation-->
<section class="navigation">
<?php $quanta->renderComponent('navbar'); ?>
</section>

<section class="content">
<?php $quanta->processRouting(); ?>
</section>

<!--footer-->
<section class="footer">
<?php $quanta->renderComponent('footer'); ?>
</section>

<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
</body>

</html>