CodeIgniter Forums
second MY_ controller not working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: second MY_ controller not working (/showthread.php?tid=58194)



second MY_ controller not working - El Forum - 05-23-2013

[eluser]murichej[/eluser]
application/core/MY_Controller.php
Code:
<?php
if (! defined('BASEPATH')) exit ('No direct script access allowed');

class MY_Controller extends CI_Controller
{
    
    function __construct()
    {
        parent::__construct();
        
        ...
        
    }
    
}

application/core/MY_Controllerfront.php
Code:
<?php
if (! defined('BASEPATH')) exit ('No direct script access allowed');

class MY_Controllerfront extends CI_Controller
{
    
    function __construct()
    {
        parent::__construct();
        
         ...      
        
    }
    
}

and then I try to extend theese two

that one is working:
Code:
class Blog extends MY_Controller {

that one doesn't:
Code:
class Blog extends MY_Controllerfront {

i get
Quote:Fatal error: Class 'MY_Controllerfront' not found in C:\xampp\htdocs\MMUblog\application\controllers\front\blog.php on line 3

need help Sad


second MY_ controller not working - El Forum - 05-23-2013

[eluser]boltsabre[/eluser]
Check this out and let us know if it solves your problems, it's from Phil Sturgeon, he's like the god of CI!!!

http://philsturgeon.co.uk/blog/2010/02/CodeIgniter-base-Classes-Keeping-it-DRY


second MY_ controller not working - El Forum - 05-23-2013

[eluser]murichej[/eluser]
thanks, it's working!


second MY_ controller not working - El Forum - 05-23-2013

[eluser]boltsabre[/eluser]
No worries, glad to hear you're up and going!!!