Welcome Guest, Not a member yet? Register   Sign In
Extended Controller class not found - stumped!
#13

[eluser]Phil Sturgeon[/eluser]
I think philpem & dmorin are argueing at cross purposes here.

dmorin: You are right, I always use __construct when I can instead of Classname but there is a problem. __construct is a method, and if that method is not used when the class is written then you cannot call it. The only way you can use both is if you do the following when writing classes:

Code:
<?php
class Something {

   function __construct()
   {
      // do your main construct code
   }

   function Something()
   {
      $this->__construct();
   }
  
}
?>

Sadly CodeIgniter doesnt have this so you cannot call __construct with any CodeIgniter code you have not written yourself.

Make sense? :-)

Also, instead of writing several classed in one file, I do something like this:

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

// Code here is run before ALL controllers
class MY_Controller extends Controller
{    
    function MY_Controller()
    {
        parent::Controller();
        
                // shared logic for ALL controllers
        }
}

include(APPPATH . 'libraries/Public_Controller'.EXT);
include(APPPATH . 'libraries/Admin_Controller'.EXT);

I hope some of that can help you.


Messages In This Thread
Extended Controller class not found - stumped! - by El Forum - 11-16-2008, 01:19 PM
Extended Controller class not found - stumped! - by El Forum - 11-16-2008, 02:00 PM
Extended Controller class not found - stumped! - by El Forum - 11-16-2008, 02:10 PM
Extended Controller class not found - stumped! - by El Forum - 11-16-2008, 02:22 PM
Extended Controller class not found - stumped! - by El Forum - 08-04-2009, 02:52 PM
Extended Controller class not found - stumped! - by El Forum - 10-20-2009, 02:35 PM
Extended Controller class not found - stumped! - by El Forum - 10-20-2009, 02:50 PM
Extended Controller class not found - stumped! - by El Forum - 10-20-2009, 05:10 PM
Extended Controller class not found - stumped! - by El Forum - 10-20-2009, 09:45 PM
Extended Controller class not found - stumped! - by El Forum - 10-21-2009, 06:56 AM
Extended Controller class not found - stumped! - by El Forum - 10-21-2009, 07:04 AM
Extended Controller class not found - stumped! - by El Forum - 10-21-2009, 07:16 AM
Extended Controller class not found - stumped! - by El Forum - 10-24-2009, 11:02 AM
Extended Controller class not found - stumped! - by El Forum - 10-24-2009, 11:46 AM
Extended Controller class not found - stumped! - by El Forum - 03-18-2011, 05:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB