Ixonn Group

Module Views

You are here:
< All Topics

In most cases, you will want your module to have view (html) files to be outputted to the user e.q. for a feature inside the admin area with form and inputs or some custom feature that will be used for the clients area.

If you haven’t worked with Codeigniter views, you should check their official documentation to get more familiar.

To create views for your module you must create views folder in /modules/[module_name]

After you create the folder views the path will be:

The views files intended to output HTML but the file names must end with .php, for example [module_name]/views/form.php

Loading View Files In Admin Area

The process of loading views in the admin area is the same regular process Codeigniter uses e.q. in your module controller at the very end of the method add:


Sample Admin View

Ixonn does not have any template engine for the admin view, probably you will want to use the header and sidebar for the admin area and all required Javascript/CSS files, in this case, you can use 2 functions init_head() and init_tail() in your view to achieving this.

Find an example below for a view file intended for the admin area.

<?php defined(‘BASEPATH’) or exit(‘No direct script access allowed’); ?>

<?php init_head(); ?>

<div id=”wrapper”>

   <div class=”content”>

      <div class=”row”>

         <div class=”col-md-12″>

            <div class=”panel_s”>

               <div class=”panel-body”>







<?php init_tail(); ?>



Loading View Files in Clients Area

The clients area has a slightly different process of loading the files because uses a theme, in this case, you will want your module to get the theme footer and header, including any CSS and Javascript files.

When your module needs to load a view file for the theme area, make sure that your controller extends the ClientsController.



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


class Sample_module extends ClientsController


    public function index()



         * Pass data to the view


        $this->data([‘sample_data’ => []]);



         * Set page title


        $this->title(‘Page Title’);



         * The view name




         * Render the layout/view





Loading View Files in Other Location

The views in most cases are loaded from the controllers, but if you want to load view file e.q. from helper or custom PHP class or function, you will need to prefix the file with your module name.

Here is a quick example

function module_name_load_customer_form(){

        $CI = &get_instance();



Working With Forms

Click here to read more about working with forms in views.

Related Articles

Table of Contents
Scroll Up