Welcome Guest, Not a member yet? Register   Sign In
Class not found
#8

[eluser]drewbee[/eluser]
Ah. As far as I know, you can only auto extend it two classes deep, and you are trying to go three. Controller > Auth > Gallery.

One thing I don't really understand is why you need to extend the authentication class for yoru Gallery class? Your actually breaking the rules of MVC and object orientation. Auth has nothing to do with Galleries. IE Gallery is not a 'type of' Auth. Sure, they should definitely interact, but extension I wouldn't do.

Here is what I would do.

Code:
// Everything your authentication class does. Put any auto-executing code in the __construct() function
class Auth extends Controller
{
     function __construct()
     {
          parent::__construct();
     }

     function isAllowed($action)
     {
         // return true if user is allowed to do action
     }
}

// our gallery class
class Gallery extends Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->library('auth');
    }

    function showImage($image)
    {
         if ($this->auth->isAllowed('view_image'))
         {
             echo $image;
         }
    }

}

Do you see how you do not need inheritance, yet you can keep your auth on every single page that you need it by simply loading it. Also, you can also auto-load it on every page if you do not want to manually load it by using the autoload configuration directive.


Messages In This Thread
Class not found - by El Forum - 09-02-2008, 04:25 PM
Class not found - by El Forum - 09-03-2008, 03:15 AM
Class not found - by El Forum - 09-03-2008, 03:57 AM
Class not found - by El Forum - 09-03-2008, 09:55 AM
Class not found - by El Forum - 09-03-2008, 11:16 AM
Class not found - by El Forum - 09-03-2008, 12:45 PM
Class not found - by El Forum - 09-03-2008, 01:19 PM
Class not found - by El Forum - 09-03-2008, 03:33 PM
Class not found - by El Forum - 09-03-2008, 04:17 PM
Class not found - by El Forum - 09-03-2008, 05:04 PM
Class not found - by El Forum - 09-03-2008, 07:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB