Controller in subfolders and with index pages on every subfolder |
[eluser]bartgrrr[/eluser]
Hi, Lets say next controller directory structure: controllers/sparen/juniorsparen/berekenen controllers/sparen/juniorsparen/faq controllers/sparen/spaarrekening/berekenen controllers/sparen/spaarrekening/faq controllers/pensioen/pensioensparen/berekenen controllers/pensioen/pensioensparen/faq where juniorsparen is my controller and berekenen and faq are my controller methods, so the corresponding urls are: http://www.mysite.com/sparen/juniorsparen/berekenen http://www.mysite.com/sparen/juniorsparen/faq where spaarrekening is my controller and berekenen and faq are my controller methods, so the corresponding urls are: http://www.mysite.com/sparen/spaarrekening/berekenen http://www.mysite.com/sparen/spaarrekening/faq where pensioensparen is my controller and berekenen and faq are my controller methods, so the corresponding urls are: http://www.mysite.com/pensioen/pensioensparen/berekenen http://www.mysite.com/pensioen/pensioensparen/faq What I want is the following: http://www.mysite.com/sparen goes to an index page with 2 links to an index page of juniorsparen and spaarrekenig http://www.mysite.com/sparen/juniorsparen goes to an index page with 2 links to berekenen and faq (of juniorsparen) http://www.mysite.com/sparen/spaarrekening goes to an index page with 2 links to berekenen and faq (of spaarrekening) http://www.mysite.com/oensioen goes to an index page with a link to pensioensparen (of pensioen) http://www.mysite.com/oensioen/pensioensparen goes to an index page with 2 links to berekenen and faq (of pensioensparen) The problem is in the MY_Router class, it only permits controllers at the lowest/highest level of my directory structure. I don't know how to fix it! The code of the MY_ROUTER class: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]Pert[/eluser]
You should be able to use <b>config/routes.php</b> file. Maybe create a <b>controllers/landing.php</b> with method for each landing page and then route it with something like Code: $route['sparen'] = 'landing/sparen'; I have to say it might not work as I can't test it right now, but that would be the first thing I'd try if I had similar issue myself.
[eluser]bartgrrr[/eluser]
Thanks Pert. It's works just fine with this kind of solution!!!! |
Welcome Guest, Not a member yet? Register Sign In |