Custom modules

madCMS has been designed to allow a degree of extensibility without touching the core code. It is fairly straightforward to add and integrate custom functionality (modules) into a madCMS website.

A default installation of madCMS should set up these files and folders on the hosting server:

- pageDisplay.php
- index.php
  + stylesheets (folder)
  + madcms (folder)
  + images (folder)
  + custom (folder)

The default code in pageDisplay.php will check if the following parameter is passed in the URL: pageDisplay.php?module=custom and redirect to a file in the custom folder named PublicDisplayCustom.php.

The file PublicDisplayCustom.php can be modified to further re-direct to your custom module(s).

The simplest approach is to put any custom code in subfolders in the custom folder, then use a case switching statement in the PublicDisplayCustom.php file to pull in those custom modules.

For example, if you created a blog and a forum and installed them in subfolders in the custom folder, the PublicDisplayCustom.php code might be:

     switch ($type)
     {            
       case "blog":
       include("custom/blog/index.php");
         break;
       case "forum":
       include("custom/forum/index.php");
         break;
      }

And the URLs to call these would be:

You can add these into your website navigation as decribed in the Submenu URL Link section of the User Manual.

This all sounds more complicated than it actually is! The approach, however, allows you to integrate (or remove) custom modules into your website without impacting on the core madCMS code. 

Thoughts...

Life is pleasant. Death is peaceful. It's simply the transition that's troublesome. (Isaac Asimov)