Extending controller-class to another controller-class? |
Hi,
Just out of curiosity, can I extend my controller-class with another controller-class? I don't know what term to use but here's an example: PHP Code: // Location: application/controllers/Welcome.php If this is possible, maybe I can use this technique in the future. Thank you.
Yes, you can extend core CI_Controller, then make your controllers use your new extended controller class.
Some more information over here: https://www.codeigniter.com/user_guide/g...asses.html From your example I guess you were looking to use same controller code for different URL? You can do that via routing (https://www.codeigniter.com/user_guide/g...uting.html) PHP Code: $route['valkommen'] = 'welcome/index/se'; PHP Code: class Welcome extends CI_Controller |
Welcome Guest, Not a member yet? Register Sign In |