• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to locate the specified class: Session.php

#11
It sounds like the CI initialization hasn't progressed enough at that point.
Is there a problem having your logic at the beginning of your controller's constructor?

If it is something you want executed for every controller, you could make core/MY_Controller and build on that.
Reply

#12
Another thought ... your hook is just a regular class, right?
You might have to...

$CI=&get_instance();
$CI->session->...
Reply

#13
These two are good suggestions.
I will try them now.

If i remove session from autoload, and load it in post controller construction
session is successfully loaded in that controller. but not working in other controllers

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Home::$session

Filename: controllers/Home.php

Line Number: 16

Backtrace:

File: C:\codeigniter\application\controllers\Home.php
Reply

#14
Pre-hooking controller construction means that you don't have anything loaded inside the controller object so the last suggestion of ciadmin will help you.

BTW instead of prehooking controllers I can suggest another tactic using MY_Controller which will be used from your controllers and will extend CI_Controller..
There you will have real control of the ci controller construct + you can add any custom common method for all controllers.
Best VPS Hosting : Digital Ocean
Reply

#15
(11-12-2014, 02:26 AM)sv3tli0 Wrote: Pre-hooking controller construction means that you don't have anything loaded inside the controller object so the last suggestion of ciadmin will help you.

BTW instead of prehooking controllers I can suggest another tactic using MY_Controller which will be used from your controllers and will extend CI_Controller..
There you will have real control of the ci controller construct + you can add any custom common method for all controllers.

It is hard to help the Original Poster, as there is no mention as to what the goal of the pre-hook is.

I have only found one use for the hooks in my projects.

I tend to use the My_Controller approach, which gives me all I need, as you can hook into the __construct and the __destruct to take care of what you need to at the start and then end of a run.

I can see a use for the hook if you have some analytics and have the page cache system running.
Reply

#16
The error happens here when CI can't find a view file.
Reply

#17
Well I think that I found the solution, I'm having this issue in just one controller, that have the same name of a library, so when I try to execute the controller that have the same name of the library this erros happened. So I just renamed my controller e voila no problem anymore.

I hope this helps!!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.