CodeIgniter Extending Multiple Controllers? |
[eluser]Unknown[/eluser]
Probably posted here 100 times but I cannot find it in search. Can't find a way to do this, possibly because there is another way to do this? Some of my controllers extend AdminLayout and some of them extend ModLayout but I also need these pages to extend a LoggedIn Controller. Code: class Profile extends AdminLayout, LoggedIn { However looking into there is no way to do this nicely. Is there a workaround? EDIT: Another thing, when I use the redirect helper and go: Code: redirect('/'); It redirects me to site.com/index.php not site.com, any solutions?
[eluser]PhilTem[/eluser]
A class can only extend one parent-class. But it may however implement multiple interfaces. Before posting too much code, have a look at http://stackoverflow.com/questions/35612...ass-in-php. And don't forget you can have hierarchical extends like a parent-class, a grandparent-class and so on and so forth ![]() On your second question: Where do you want to redirect to? If you use '/' then it will redirect to base_url() . '/'. If you want to redirect to your base_url(), use Code: redirect(base_url());
[eluser]Unknown[/eluser]
Thanks, that solution worked well, although messy haha. As for the redirect, I am trying to remove the index.php from my URL using htaccess but this code snippet does not work for some reason: (mod_rewrite enabled) Code: <IfModule mod_rewrite.c> |
Welcome Guest, Not a member yet? Register Sign In |