Skip to content


Christopher Day edited this page Sep 11, 2018 · 8 revisions

When creating a module all files relating to that module should be stored in modules/{moduleName}/. Each module requires a moduleInfo.php file, for more information on this file go Here.

Within this folder you can also have the following files:

  • {moduleName}.inc.php - This is the core controller file for your module, here you make your DB calls and send parameters to the templating engine so that they can be rendered on the page.
  • {moduleName}.tpl.php - This file contains all templating elements for this module. This is used for the game and admin controllers. For more information on templating go here
  • {moduleName}.admin.php - This is like {moduleName}.inc.php but this determines what the admin can edit for this module

Example module template file


    class blankTemplate extends template {
        public $loginPage = false; // Ture means you can access this page without being logged in
        public $jailPage = true; // True means you can view this page in prison
        public $blankElement = '<h1>{var1} - <small>{var2}</small></h1> <p>{var3}<p>';


As you can see you need to declare a few variables public $loginPage - This defines if the user can see the page if they are not logged in, if set to true the user is able to view the page without needing to login

public $jailPage - This is very similar to $loginPage but for the jail.

Making custom elements

You can make your own custom elements for use in the modules functionality all you have to do is make a public variable and give its value the HTML you want to output, if you want to bind variables to the html you can use {var1}, {var2}, {var3} etc ... , when we build an element from this later the varibles will be replaced with what you want.

Example of module functionality


    class blank extends module {
        public $allowedMethods = array('someGetVar'=>array('type'=>'get'));
        public function constructModule() {

        public function method_doSomething() {

            $id = $this->methodData->someGetVar;



The module functionality must have the constructModule function defined, this is called when the module is loaded and should be used to build the html for the module.

Module Methods

If you want the module to do something (for example commit a crime) you need to make a function called method_{methodName}. If the GET variable action id detected in the address bar the method with that name will be run automaticly i.e. if the url was ?page=crime&action=commit&id=1 the script will see if there is a function called method_commit if it exists it will run that function.

Method Data

Rather then use $_GET and $_POST the script uses $this->methodData->{variable} these have to be registered at the start of the script by defining the public $allowedMethods variable. When defining your methods you need to do it in this format public $allowedMethods = array('varibleKey'=>array('type'=>'(post|get)'), 'varibleKey2'=>array('type'=>'(post|get)'));. Once you have defined the allowed methods they will be available to use in $this->methodData.

The action method is pre-defined so you dont need to add it to everypage.

You can’t perform that action at this time.