Coderity Documentation

How to Install

1) Once the source is downloaded, ensure that the app/tmp (and subfolders) are writable.

2) Create a new database and dump the following sql into the DB:

3) Copy the app/Config/database.php.default file to app/Config/database.php and set your database details.

4) Open the website in your browser.  You will be taken to the Coderity Installer where you can set your site details and create the Admin user.


In app/Config/bootstrap.php you will find the following block of code, which allows you to turn on / off various features of Coderity.  These features are explained in more detail below.

   Configure::write('Coderity', array(
      'routes' => array(
                  'autoRouting' => true,
                  'autoRoutingIgnoreRoutes' => 'add|view|display|delete|admin|users|leads|blog'
      'blocks' => true,
      'articles' => true,
      'leads' => true,
      'redirects' => true,
      'additionalAdminMenu' => array()


When set to true, AutoRouting will be enabled, which will automatically set any pages you add to:

For example, if you created a page called "About", with a slug "about", the page will automatically exist at "/about".

If AutoRouting is set to false, then the page will exist at "/page/:slug", for example "/page/about".

The consequence of enabling AutoRouting, is that you need to manually need to update the autoRoutingIgnoreRoutes, for example, if you create a new Controller, such as "app/Controller/ImagesController.php", then you will need to tell autoRoutingIgnoreRoutes to ignore the controller from the autoRoutes by adding it to the ignore rules.

For example: add|view|display|delete|admin|users|leads|blog|images

In this case, "|images" has been added to the end of the ignore rules.

Blocks, Articles, Leads, Redirects

Depending on whether you need to run these features on your site, you can turn them off or on here.  For example, If you don't need a blog, or leads system, you can set these to false here, and they will not show in the Admin Menu.


As your application grows, you will likely need to add links to the Admin Menu.  This feature allows you to add links easily from your app/Config/bootstrap.php file.  For example:

'additionalAdminMenu' => array('Images' => array('url' => array('controller' => 'images', 'action' => 'index'), 'icon' => 'fa-file-image-o'))

The Coderity Admin CMS uses Font Awesome, so you can select any icons for the CMS menu icons.


Once you have installed Coderity, it is recommended that you set checkInstall to false.  This is an extra security feature.  If installing Coderity, ensure this is set to true to run the installer.

Explaining the Coderity Features

To use the features of Coderity requires very little code in your front end CakePHP Views.  The following is a guideline for using the features of Coderity.


Pages make up the individual pages of your website.  You can add, edit and delete your pages.

One of the important aspects of the pages, is that by checking a page to show in the top and / or bottom menu, your front end navigation will automatically be created.

Dropdowns can also be easily created by assigning pages as "children" of "parent" pages, e.g:

-> The Team
-> Company History
-> Jobs

In this case, the "About" page is the parent page, while the other pages are the child pages.

From the main pages page, you can also drag n drop the ordering that the pages will display in the menu.

In your front end Views, you can install the top menu with the following line of code:

<?php echo $this->element('menu'); ?>

If you want to display the bottom menu, use:

<?php echo $this->element('menu', array('type' => 'bottom')); ?>

There are some additional parameters you can pass, such as:

ul.class - will set the main ul class of the menu.

li.class - will set any class names for each menu item li class. - the name of the active class for the current page.  The default is "active".

children.ul.class - will set the dropdown ul class of the menu. - will set any class names for each dropdown menu item li class. - the name of the active class for the current page for a dropdown item.  The default is "active".

An example of this in use, would be:

<?php echo $this->element('menu', array('ul' => array('class' => 'nav)), 'li' => array('class' => 'menu', 'active' => 'selected'), 'children' => array('li' => array('class' => 'dropdown'), 'ul' => array('class' => 'collapse'))); ?>

Content Blocks

Content Blocks form the other elements of the page, such as editable areas of the header and footer.  They are sections of the page which are not page specific, e.g. they show on every page.

You would add a Content Block if you want to make a small block of the page editable.

For example, say you wanted to make the phone number at the bottom of the page editable.  Simple make a new content block called "Phone Number" and insert the HTML into the HTML editor.

A Slug / Key will be automatically generated, in this case, it will be called "phone_number".

In your front end Views, you can then insert the Site Block by simple calling:

<?php echo $this->element('block', array('key' => 'phone_number')); ?>

This will display the HTML, and allow that content to be editable in the CMS.


Articles allow you to easily add, edit and delete different blog articles.

The articles will automatically appear on the front end at the URL /blog or /articles.

If you would like to add some introduction text, or perhaps add the main articles page into the navigation, simply create a new general page and ensure that the slug is set to "blog".

This will then automatically assign the navigation to the main articles page in the front end.


Coderity comes with a nice contact form by default.  This can be easily expanded on if needed by adding new columns to the "leads" table.

In order to show the contact form in one of your pages, simply set the "Page View" to contact when you add or edit a page.

This will then show the contact form, and if need be, you can edit the fields by editing the file: app/View/Pages/contact.ctp