Giter Club home page Giter Club logo

crayon-cms's Introduction

Crayon CMS

A simple CMS, which requires no database. All data are stored in twig and json files.

Demo: cms.cinquiemecrayon.eu

Installation

  1. Clone or download the CMS source.
  2. Run composer to download dependencies.
  3. Change file name _install.dist to _install.php
  4. Run yarn.
  5. Generate assets:
    • Develop npm run dev
    • Production npm run prod
  6. Go to Back Office (yourdomain/_bo) and change admin password.
  7. Configure site (yourdomain/_bo/settings.php).

Routing

Crayon CMS uses the altorouter routing class.

Path

Blog

| function     | variable       | example                |
|--------------|----------------|------------------------|
| articlesList | [i:page]?      | blog/[i:page]?/        |
| article      | [slug:article] | blog/[slug:article]    |

Variables of the path are passed to the controller in the $dp array.

Variables

Variables are divided by | character. They are passed to the controller in the $sp array.

SiteController

| function | 1st variable  | 2nd variable |
|----------|---------------|--------------|
| page     | alias of page | -            |
| contact  | menu name     | -            |

BlogController

| function     | 1st variable                 | 2nd variable |
|--------------|------------------------------|--------------|
| articlesList | id of category (0 for all    | menu name    |
|              | categories assigned to menu) |              |
| article      | -                            | -            |

Twig

Global variables

root

Site main directory.

routes

Array with created routes.

Examples:

Generate link:

<a href="{{ root~routes['home'].path }}">{{ routes['home'].name }}</a>

settings

Array with site settings.

Examples:

<title>{{ settings['site_name'] }}</title>

Templates

You can create your own twig templates by overloading the base template. Place your files in /views/_templates/{name of template} directory. The directory structure should be the same as the main view directory. Example:

/views/_templates/new_template/base.html.twig
/views/_templates/new_template/blog/article.html.twig

The folder name with the new template appears in the settings.

Translations

You can use the twig global variable t for rendering strings.

Example:

<p>{{ t.message }}</p>

Add this line:

<scipt src="{{ root }}/js/translation.js?lang={{ menu.lang }}"></script>

to your template for generate an js global object with current language's translations. You can use this object in your js. Exaple:

alert(translate.thank_you);

Users

You can create new users in admin panel. To give the user permission to edit content in the admin panel you need to add the appropriate permissions in data/users.json file. Example:

{
  "123": {
    "role": "",
    "pwd": "password",
    "permissions": [
      "pages",
      "files",
      "files.manager",
      "files.uploader",
      "file.upload",
      "file.remove",
      "gallery",
      "gallery.items"
    ]
  }
 }

Permission names are filenames in the _bo directory.

crayon-cms's People

Contributors

pistom avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

veritas44

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.