CodeIgniter Forums
Module Routing - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Module Routing (/showthread.php?tid=60195)



Module Routing - El Forum - 02-03-2014

[eluser]xtremer360[/eluser]
I have he following url for my codeigniter application and I'm trying to find out how I can view this specific controller with the url. The my-project is what is used for my cms and the "admin" url segment is a variable representing a section of the cms area, "users" is the module from which I need to get the admin.php file for. I am using the wiredesignz 3rd page HMVC plugin into this application.

testsitehere.com/my-project/admin/users

Code:
-application
    -modules
        -users
            -controllers
                admin.php

I have tried the following route but still received the 404 error page.

Code:
$route['my-project/:any/:any'] = '$1/$2/admin';

What am I doing wrong for it to not work?


Module Routing - El Forum - 02-03-2014

[eluser]Tpojka[/eluser]
Maybe I had similar problem yesterday. Check this topic if helps.



Module Routing - El Forum - 02-03-2014

[eluser]ivantcholakov[/eluser]
Your example is wrong. Have a look at this real-life configuration file routes.php and adapt it for your case. Leave the lines that you need.

Code:
$route['default_controller'] = 'home';

if (isset($_SERVER['REQUEST_URI']) && stripos($_SERVER['REQUEST_URI'], '/admin') !== false) {
    $route['404_override'] = 'admin/error_404';
} else {
    $route['404_override'] = 'error_404';
}

$route['translate_uri_dashes'] = TRUE; // since CI 3.0

$route['admin/([a-zA-Z_-]+)/(:num)']        = '$1/admin/index/$2';
$route['admin/([a-zA-Z_-]+)/(:num)/([a-zA-Z_-]+)'] = '$1/admin/$3/index/$2';
$route['admin/([a-zA-Z_-]+)/(:num)/([a-zA-Z_-]+)/([a-zA-Z_-]+)'] = '$1/admin/$3/$4/$2';
$route['admin/([a-zA-Z_-]+)/(:num)/([a-zA-Z_-]+)/([a-zA-Z_-]+)/(:num)'] = '$1/admin/$3/$4/$2/$5';
$route['admin/([a-zA-Z_-]+)/(.+)']          = '$1/admin/$2';
$route['admin/([a-zA-Z_-]+)']               = '$1/admin/index';

$route['([a-zA-Z_-]+)/(:num)']              = '$1/index/$2';
$route['([a-zA-Z_-]+)/(:num)/([a-zA-Z_-]+)/(:num)'] = '$1/$3/$2/$4';

$route['sitemap.xml']                       = 'sitemap/xml';



Module Routing - El Forum - 02-03-2014

[eluser]ashish64[/eluser]
[quote author="xtremer360" date="1391471045"]I have he following url for my codeigniter application and I'm trying to find out how I can view this specific controller with the url. The my-project is what is used for my cms and the "admin" url segment is a variable representing a section of the cms area, "users" is the module from which I need to get the admin.php file for. I am using the wiredesignz 3rd page HMVC plugin into this application.

testsitehere.com/my-project/admin/users

Code:
-application
    -modules
        -users
            -controllers
                admin.php

I have tried the following route but still received the 404 error page.

Code:
$route['my-project/:any/:any'] = '$1/$2/admin';

What am I doing wrong for it to not work?[/quote]


you and i have same problem i think. still no solutions
check my issue http://ellislab.com/forums/viewthread/242694/


Module Routing - El Forum - 02-04-2014

[eluser]InsiteFX[/eluser]
In HMVC if you name the controller the same as the module directory name you do not need a root for it.

Also make sure you add this to your application/config/config.php file
Code:
/*
|--------------------------------------------------------------------------
| Module Paths
|--------------------------------------------------------------------------
|
|
*/
$config['modules_locations'] = array(
APPPATH.'modules/' => '../modules/',
);