简体   繁体   中英

Creating subfolders for CodeIgniter HMVC

I'm using CodeIgniter with HMVC and am trying to organise the folder structure more effectively. Currently I have it setup in the standard fashion of:

application/modules/#module_name#/controllers/#controller_name#

But I would like to be able to group together all of the controllers that are connected into a subfolder like this:

application/modules/#module_name#/controllers/#sub_folder_name#/#controller_name#

I've searched for details on this an cannot find if it can be done and how it would be done. Any help would be greatly appreciated

Try,

<?php
    $system_folder = "system";
    $application_folder = "application";

    if (function_exists('realpath') AND @ realpath(dirname(__FILE__)) !== FALSE) {
        $system_folder = str_replace("\\", "/", realpath(dirname(__FILE__))) . '/' . $system_folder;
    }

    if (is_dir($application_folder)) {
        define('APPPATH', $application_folder . '/');
    } else {
        if ($application_folder == '') {
            $application_folder = 'application';

            if ($application_subfolder == '') {
                $application_folder = 'application';
            }


            define('APPPATH', BASEPATH . $application_folder . '/');
        }
    }

    if (!defined('E_STRICT')) {
        define('E_STRICT', 2048);
    }

    require_once BASEPATH . 'codeigniter/CodeIgniter' . EXT;
    echo 'hello testing !!!';
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM