I'm using FuelPHP for my website. Currently, I've the following structure:
-folder1
-FILEHERE.php
-folder2
...
-fuel
-app
-classes
-controller
-learn.php
-folder1.php
-public
I've created a controller in fuel->classes->controller
with the name learn.php. Now what I want is this: If the person visits http://example.com/learn
-> this controller fires up (learn.php). I want to add a sub-controller and throw control to that whenever there is a next directory request. ie: http://example.com/learn/folder1 should throw control to folder1.php
in fuel->classes->controller
.
How do I do this? I've checked the methods action_* but they don't look flexible. Also, once the user visits something like: http://example.com/learn/folder1/FILEHERE
It should load the content file from folder1->FILEHERE.php
(see the directory layout above)
Thank you for your help!
You can easily do this using FuelPHP's routing functionality. Which is documented here .
Your basic route config for the folder1
controller might look something like this:
'learn/folder1' => 'folder1/index',
The documentation outlines more complex examples as well if needed.
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.