Mecha CMS

Mecha CMS blog and documentation.

Dynamic Menus

Updated: Sunday, 07 August 2016

Creating dynamic menus from a file.

You can add more menus dynamically by creating a file named as menus.php, stored in a folder named as workers. This applies to shields and plugins:

Example for shield:

your-shield-name/
 ├── workers/
 │   └── menus.php
 ├── …
 ├── …
 └── …

Example for plugin:

your-plugin-name/
 ├── workers/
 │   └── menus.php
 ├── about.txt
 └── launch.php

The menus.php file only contains array of menus data:

<?php

return array(
    'manager' => array(
        'Article' => 'manager/article',
        'Page' => 'manager/page',
        'Tag' => 'manager/tag'
    ),
    'bar' => array(
        'Article' => 'manager/article',
        'Page' => 'manager/page',
        'Tag' => 'manager/tag'
    )
);
Donation and Email Subscription