Hernyo

Documentation

Hernyo CMS is a very simple and lightweight CMS and has a very brief documentation.

View Demo

Theming

Themes are located in the /theme folder and the main template file is the ìndex.html file. Variables are placed using the double curly bracket syntax {{ $variable_name }} i.e: in order to print the page title you'll use the {{ $HERNYO['page']['title'] }} code in the template.

Variables

The elements to be used when theming your website using Hernyo CMS are encapsulated in an array called $HERNYO, and has the following variables :

  • $HERNYO['site'] :

    • ['site_language'] ISO 639-1 Language Code has the two letter identifier like: EN, ES, FR ...
    • ['site_title'] : Returns the Site Title.
    • ['site_description'] : mainly for seo purposes
    • ['site_keywords'] : same as above.
    • ['path] : base directory ( dirname($_SERVER['PHP_SELF']) )
    • ['url] : url where the website resides ( HTTP_HOST + path )
  • $HERNYO['pages'] : Variable contains all the data of every page in case you want to loop over it. Each page contains the following properties described below in the $_PAGE variable.

  • $HERNYO['page'] :

    • ['title'] The page title
    • ['description'] Short description of the page
    • ['content'] This is stored as Markdown but it returns the parsed HTML code of the page content
    • ['tags'] Comma separated tag values
    • ['datetime'] human-readable date/time in the form : 1914-12-20 08:30:45
    • ['timedate'] Verbose time-date returned by default in the form (i.e) : Thursday 12th of February 2009 @ 04:25 AM ( Date: l jS \of F Y @ h:i A )
    • ['link'] Returns the full url friendly link of the page in case mod_rewite exists on the Apache modules or the link with a url get variable in case it doesn't ?p=url-slug
    • ['slug'] the slug defined on the admin area.
  • $HERNYO['is_page'] : Boolean returns if it is a page or not ( Useful to filter the index/home page )
  • $HERNYO['menu'] : Retuns an HTML unordered list with all the active pages linked to it. With an active class on the current element ( class="active" )
  • $HERNYO['prev_page'] full url friendly link to the previous page if exists, otherwise will return a link to the site url.
  • $HERNYO['next_page'] full url friendly link to the next page if exists, otherwise will return a link to the site url.
  • $HERNYO['is_404'] : Boolean returning if the page is a 404 not found file.

Adding extra variables

On the config.php file, you can add more 'key' => 'value' items to the returned array to access them later on. They will be encapsulated in the parent array $HERNYO['site']

For example, adding the following to the config array : 'my_var' => 'my_value'

<?php return array (
  'user' => 'hernyo',
  'pass' => 'password' //it is replaced with the hash,
  'db' => 'data.dat',
  'site_language' => 'en',
  ...
  'files_folder' => '../files',
  'my_var' => 'my_value',
);

You can later call it by using the bracket syntax : {{ $HERNYO['site']['my_var'] }}