Mecha CMS

Files and folders structure.

Shield

Author: Taufik Nurrohman · 87 Views

Tweet

WTF is shield?

Table of Content

Shield is a term used by Mecha to express theme in another CMS.

A shield is a folder with a unique name, stored in lot\shield folder:

lot\
 └── shield\
     ├── document\
     ├── shield-1\
     ├── shield-2\
     ├── …
     └── …

A standard shield should at least contains files that structured like this:

document\
 ├── asset\
 │   ├── .htaccess
 │   ├── css\
 │   │   ├── document.css
 │   │   └── document.min.css
 │   └── js\
 │       ├── document.js
 │       └── document.min.js
 ├── state\
 │   └── config.php
 ├── 404.php
 ├── about.page
 ├── footer.php
 ├── header.php
 ├── index.php
 ├── page.php
 └── pages.php

Note: The .htaccess file is required to enable access of the asset files publicly. It only contains this command:

allow from all

Error 

Minimum requirements for 404.php file:

<?php Shield::get('header'); ?>
<p>404 not found!</p>
<?php Shield::get('footer'); ?>

Index 

This file contains custom functions used by the shield:

<?php

Asset::set('css/document.min.css');
Asset::set('js/document.min.js');

Header 

Minimum requirements for header.php file:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="<?php echo $site->charset; ?>">
    <link href="<?php echo $url; ?>/favicon.ico" rel="shortcut icon">
    <title><?php echo To::text($site->page->title); ?></title>
  </head>
  <body>
    <header>
      <h1><?php echo $site->title; ?></h1>
      <p><?php echo $site->description; ?></p>
    </header>

Footer 

Minimum requirements for footer.php file:

    <footer>
      <p>&#x00A9; <?php echo $date->year; ?></p>
    </footer>
  </body>
</html>

Page 

Minimum requirements for page.php file:

<?php Shield::get('header'); ?>
<main>
  <article>
    <h3><?php echo $page->title; ?></h3>
    <div><?php echo $page->content; ?></div>
  </article>
  <nav><?php echo $pager; ?></nav>
</main>
<?php Shield::get('footer'); ?>

Pages 

Minimum requirements for pages.php file:

<?php Shield::get('header'); ?>
<main>
  <?php if ($pages): ?>
  <?php foreach ($pages as $page): ?>
  <article>
    <h4><a href="<?php echo $page->url; ?>"><?php echo $page->title; ?></a></h4>
    <div><?php echo $page->content; ?></div>
  </article>
  <?php endforeach; ?>
  <?php endif; ?>
  <nav><?php echo $pager; ?></nav>
</main>
<?php Shield::get('footer'); ?>

About 

Minimum requirements for about.page file:

---
title: Shield Title
description: Shield description.
author: Shield Author
type: Markdown
link: http://example.com
version: 1.0.0
...

Usage, external credits, etc.

0 Comments

No comments yet.