Config

This folder has four files each file has its different work.

  • autoload.php

  • config.php

  • menu.php

  • route.php

autoload.php: This file load all the asset dependency in the controller. Make a config array and add all files to it, config array has a "file" key that has JS file location as value and a "location" key that has an array of locations("controller_name/method_name") as value(where this JS file going to load). Here is the detailed description of the autoload file.

autoload.php
<?PHP 
//load js file on controller function
$config['js-files'] = array(
    array(
        "file" => 'https://nightly.datatables.net/js/jquery.dataTables.js',
        "location" => array(
            "show_booking/show_latest_bookings",
            "show_booking/show_customer_list",      
            "custom_data/get_post_data",
            "option_data/get_option_data",
        ),
    ), 
    array(
        "file" => 'assets/js/booking_list.js',
        "location" => array(
            "show_booking/show_latest_bookings",
            "show_booking/show_customer_list", 
        ),
    ),
    array(
        "file" => 'assets/js/post_custom_data.js',
        "location" => array(
            "custom_data/get_post_data",
        ),
    ),
    array(
        "file" => 'assets/js/option_data.js',
        "location" => array(
            "option_data/get_option_data",
        ),
    )
);

//load css file for controller function
$config['css-files'] = array(
    array(
        "file" => 'assets/css/extension.css',
        "location" => array(
            "show_booking/show_latest_bookings",
            "show_booking/show_customer_list",
            "custom_data/get_post_data",
            "option_data/get_option_data",
            "sample_controller/index",
            "sample_controller/show_info_page",
        ),
    ),
    array(
        "file" => 'https://nightly.datatables.net/css/jquery.dataTables.css',
        "location" => array(
            "show_booking/show_latest_bookings",
            "show_booking/show_customer_list",
            "custom_data/get_post_data",
            "option_data/get_option_data",
         ),
    ),
);

//load helpers file 
$extension_helper = array(
    'booking_list_helper'
  );

config.php: This file has the config array containing the extension details such as name, description, or any information about it. 'is_default_active' key has 1 or 0. Here is the detailed description of the config file.

menu.php: This file has menu-related details such as the extension's menu label, position on the menu bar, and route link. In this array, the 'location' key has a value such as PRIMARY, SECONDARY, and THIRD. 'label' key has menu label, 'link' key has URL link.

route.php: This has an array of extension routes, the route will be defined as the same ci route. Here is the detailed description of the route file.

Last updated