![]() |
Sub Directory on Controller - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Sub Directory on Controller (/showthread.php?tid=73262) Pages:
1
2
|
Sub Directory on Controller - finhawkman - 04-05-2019 Hello, I decided to try codeigniter version 4 now, . But I found a problem when trying to use the subdirectory in my controller. . This preview my code. . [Structor Subdirectory + Class] ![]() [Controller Shoes.php] ![]() [Accessing Url] ![]() ^_^ please help me to make this work .. thanks brother RE: Sub Directory on Controller - finhawkman - 04-06-2019 Fix.. use namespace using sub-directory itself like this... . Thanks ^_^ [Code Preview] ![]() RE: Sub Directory on Controller - pkMyt1 - 04-10-2019 Thanks for figuring this out. I was having the same problem and this solved it. RE: Sub Directory on Controller - michael.j - 05-02-2019 I have currently the same problem but for whatever reason i won't work ![]() Any idea? ![]() PHP Code: <?php RE: Sub Directory on Controller - finhawkman - 05-02-2019 (05-02-2019, 01:44 AM)michael.j Wrote: I have currently the same problem but for whatever reason i won't work What doesn't work? how do you access your page (ex: http: //localhost/ci4/index.php/yourcontroller/yourfunction)? ^_^ please also screenshot your browser view ![]() RE: Sub Directory on Controller - michael.j - 05-03-2019 I access the page via ip because the server is running as a virtual machine and DNS is currently not set up finally. So the current URL is always 192.168.10.40 Working: http://192.168.10.40/home Working: http://192.168.10.40/index.php/home Working: http://192.168.10.40/index.php/home/test Not working; http://192.168.10.40/products Not working; http://192.168.10.40/products/shoes Not working; http://192.168.10.40/products/shoes/test Browser Screenshot php -m Code: [PHP Modules] apachectl -M Code: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.10.40. Set the 'ServerName' directive globally to suppress this message Apache Error Log Code: [Fri May 03 09:54:17.396759 2019] [authz_core:debug] [pid 20102] mod_authz_core.c(809): [client 192.168.168.68:4670] AH01626: authorization result of Require all granted: granted Apache Access Log /products Code: "GET /products HTTP/1.1" 404 1509 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" Apache Access Log /home Code: "GET /home HTTP/1.1" 200 1899 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" .htaccess inside /public directory Code: # ---------------------------------------------------------------------- RE: Sub Directory on Controller - InsiteFX - 05-03-2019 Any sub folders you create need to be name spaced. RE: Sub Directory on Controller - finhawkman - 05-03-2019 I see there is inconsistency in writing the url.. please try to access via url like this... http://192.168.10.40/index.php/products http://192.168.10.40/index.php/products/shoes http://192.168.10.40/index.php/products/shoes/test I hope it works RE: Sub Directory on Controller - InsiteFX - 05-04-2019 Products = Controller shoes and shoes/test both = Methods Controller = segment 1 shoes = segment 2 test = segment 3 CodeIgniter 4 User Guide - Passing URI Segments to your methods RE: Sub Directory on Controller - andybiancoblu - 09-24-2019 Hi everyone, I am facing the same problem but with no luck. According to CI4 documentation found here: https://codeigniter4.github.io/userguide/incoming/controllers.html#organizing-your-controllers-into-sub-directories I should simply create subfolder with my controller in it. This is my controller: Code: <?php access url is: myenv.dev.local/dashboard/dashboard/index PS I have an apache virtualhost pointing to public/ folder as said in the documentation. Am I missing something? Thanks to all in advance! |