added twig

This commit is contained in:
Nick Yeoman 2024-08-30 00:48:44 -07:00
parent 1f7f76ade5
commit 3a01b3a4e7
4 changed files with 102 additions and 1 deletions

View File

@ -3,7 +3,7 @@ require_once(BASEPATH . '/vendor/autoload.php');
//Twig //Twig
$loader = new Twig\Loader\FilesystemLoader(BASEPATH . '/App/views/'); $loader = new Twig\Loader\FilesystemLoader(BASEPATH . '/App/views/');
$loader->addPath(BASEPATH . '/vendor/nickyeoman/nytwig/src', 'nytwig'); $loader->addPath(BASEPATH . '/vendor/4lt/novaconium/twig', 'novaconium');
$loader->addPath(BASEPATH . '/App/templates', 'override'); $loader->addPath(BASEPATH . '/App/templates', 'override');
$twig = new Twig\Environment($loader); $twig = new Twig\Environment($loader);

26
twig/head.html.twig Normal file
View File

@ -0,0 +1,26 @@
<meta charset="utf-8">
<title>{{ title | default('Welcome') }}</title>
<meta name="generator" content="nickyeoman/phpframework" />
<meta name="description" content="{{ description | default('No description given') }}">
<meta name="keywords" content="{{ keywords | default('website') }}">
<meta name="author" content="{{ author | default('anonymous') }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="{{ title | default('Welcome') }}">
<meta property="og:type" content="">
<meta property="og:url" content="">
<meta property="og:image" content="">
<link rel="manifest" href="site.webmanifest">
<link rel="apple-touch-icon" href="/icon.png">
<!-- Place favicon.ico in the root directory -->
<link rel="icon" type="image/x-icon" href="/favicon.ico">
{# https://developers.google.com/fonts/docs/getting_started #}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro|Material+Icons|Material+Icons+Outlined">
<link rel="stylesheet" href="/css/main.css">
<meta name="theme-color" content="#000000">

54
twig/master.html.twig Normal file
View File

@ -0,0 +1,54 @@
<!doctype html>
<html class="no-js" lang="en">
{% include '@override/mod_above_head.html.twig' ignore missing %}
<head>
{% include ['@override/mod_head.html.twig', '@novaconium/head.html.twig'] %}
</head>
<body id="{{ pageid | default('pageid') }}">
{# Page Header #}
<header>
{% block headerbefore %}{% endblock %}
{% include ['@override/mod_nav.html.twig', '@novaconium/nav.html.twig'] %}
{% block headerafter %}{% endblock %}
</header>
<!-- Main Content Of The Page -->
<div id="page">
<div class="container">
<div class="middle">
{% if error|default is not empty %}
{% for key, val in error %}
<div class="error">{{ val }}</div>
{% endfor %}
{% endif %}
{% if notice|default is not empty %}
{% for key, val in notice %}
<div class="notice">{{ val }}</div>
{% endfor %}
{% endif %}
<article>
{% include 'cms/mod_alex.html.twig' ignore missing %}
{% block content %}{% endblock %}
{% include 'cms/mod_simon.html.twig' ignore missing %}
</article>
</div>
</div>
</div>
{# Page Footer #}
<footer>
{% block footerbefore %}{% endblock %}
{% include ['@override/mod_footer.html.twig', '@novaconium/footer.html.twig'] %}
{% block footerafter %}{% endblock %}
</footer>
{% include ['@override/mod_foot.html.twig', '@novaconium/foot.html.twig'] %}
</body></html>

21
twig/nav.html.twig Normal file
View File

@ -0,0 +1,21 @@
<div class="container">
<div id="logo"><a href="/">Logo Goes Here</a></div>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/contact">Contact Us</a></li>
{% if loggedin|default(false) %}
<li><a href="/logout/">Logout</a></li>
{% else %}
<li><a href="/login/">Login</a></li>
{% endif %}
{% if admin|default(false) == 'admin' %}
<li><a href="/admin">Admin</a></li>
{% endif %}
</ul>
</nav>
</div>