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. i.e.:
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
folder1controller might look something like this:The documentation outlines more complex examples as well if needed.