Welcome Guest, Not a member yet? Register   Sign In
Unlimited nested folders in controller
#1

[eluser]Unknown[/eluser]
NOTE
This intend to modify the CI_router core class (CI 1.5.4),
so if you do not want to, please skip this.


in libraries/Router
CI_class
modify the _validate_segments function
replace line 200 with this code
Code:
if (file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))

replace line 206 with this code
Code:
if (is_dir(APPPATH.'controllers/'.$this->fetch_directory().$segments[0]))

replace line 215 with this code
Code:
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT) && !
is_dir(APPPATH.'controllers/'.$this->fetch_directory().$segments[0]))

insert this code after line 218
Code:
$segments = $this->_validate_segments($segments);


finally modify set_directory function to this

Code:
$this->directory .= $dir.'/';

-----------edit
Actually not finally yet, My bad, sorry.
go to system\codeigniter\codeigniter.php

modify this code ~line 216
Code:
////ORIGINAL

call_user_func_array(array(&$CI, $method), array_slice($RTR->rsegments, (($RTR-
>fetch_directory() == '') ? 2 : 3)));    



///// REPLACE WITH THIS

$num_arg = preg_match_all("|/|", $RTR->fetch_directory(), $tmp) + 2;
unset($tmp);
call_user_func_array(array(&$CI, $method), array_slice($RTR->rsegments,$num_arg));


Good luck.




Theme © iAndrew 2016 - Forum software by © MyBB