Ixonn Group

Module Controllers

You are here:
< All Topics

Ixonn uses the Codeigniter controllers feature for handling HTTP requests and output content to the user, the modules are using the same feature to handle HTTP requests and output content to the end user.

To create a controller for your module, you must create a folder named controllers in your module directory (module_name/controllers)

After you create the folder, create a file name with starting an uppercase letter, for example, Sample_module.php and add the following content:



defined(‘BASEPATH’) or exit(‘No direct script access allowed’);


class Sample_module extends AdminController




If your controller is not intended to be accessed via the admin area, make sure that the controller/class extends the ClientsController or App_Controller instead of the AdminController

When the controller will extend the AdminController Ixonn will check whether the user is logged in as a staff member and if not, will not allow any data to be outputted to this user and will redirect to the admin login area.

Make sure that your controller names/files are unique to prevent any conflicts with the core controllers or other modules.

Require valid contact (since 2.3.3).

If you extend the ClientsController and you want the controller to be accessed only by logged in and contacts with confirmed email address contacts, you can use our trait, the trait will check this for you and will perform necessary actions.



defined(‘BASEPATH’) or exit(‘No direct script access allowed’);


use app\services\ValidatesContact;


class Sample_module extends ClientsController


   use ValidatesContact;


   public function my_methhod()


       // Won’t work if there is no contact logged in and the contact email address is not confirmed.



Loading Views

Check the views section guide to get more familiar how to load views e.q. when extending the ClientsController or AdminController.

Accessing the controller

If you are not familiar with how Codeigniter controllers work, please visit the documentation to get more familiar.

After you create the controller you will be able to access the controller as:

  • crm-installation-url.com/[module_name]/sample_module/[method]
  • crm-installation-url.com/sample_module/[method] – (if the controller name is the same as your module name you won’t need to prepend the module name in the URL)
  • crm-installation-url.com/admin/[module_name]/sample_module/[
    method ] 
    – if you are using the controller for the admin area, in this case, make sure that the controller extends the AdminController class.

Related Articles

Table of Contents
Scroll Up