Mecha CMS

Learn.

Layout (TODO)

Table of Contents
  1. Error 
  2. Index 
  3. Header 
  4. Footer 
  5. Page 
  6. Pages 
  7. About 

Layout reference.

Mecha is a single site, means that we don't have any mechanism to switch theme. Only one theme per site available. TODO

A layout folder consists of:

.\
└── lot\
    └── layout\
        ├── document\
        ├── skin-1\
        ├── skin-2\
        ├── …
        └── …

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

skin-1\
├── asset\
│   ├── .htaccess
│   ├── css\
│   │   ├── skin-1.css
│   │   └── skin-1.min.css
│   └── js\
│       ├── skin-1.js
│       └── skin-1.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 static::header(); ?>
<p>404 not found!</p>
<?php static::footer(); ?>

Index 

This file contains custom functions used by the skin:

<?php

Asset::set('css/skin-1.min.css');
Asset::set('js/skin-1.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 $t; ?></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 static::header(); ?>
<main>
  <article>
    <h3><?php echo $page->title; ?></h3>
    <div><?php echo $page->content; ?></div>
  </article>
  <nav><?php echo $pager; ?></nav>
</main>
<?php static::footer(); ?>

Pages 

Minimum requirements for pages.php file:

<?php static::header(); ?>
<main>
  <?php if ($pages->count > 0): ?>
  <?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 else: ?>
  <p>No pages yet.</p>
  <?php endif; ?>
  <nav><?php echo $pager; ?></nav>
</main>
<?php static::footer(); ?>

About 

Minimum requirements for about.page file:

---
title: Skin Title
description: Skin description.
author: Skin Designer
type: Markdown
link: 'http://example.com'
version: 1.0.0
...

Usage, external credits, etc.