Welcome Guest, Not a member yet? Register   Sign In
Using custom library classes in a Hook
#1

[eluser]sherbo[/eluser]
Hey All,

I'm using a hook class that has 3
Code:
require_once
statements referring to custom classes in the "libraries" directory.

Several custom classes in the "libraries" directory also have
Code:
require_once
statements referring to other custom classes.

When I call
Code:
get_declared_classes()
, I see that
Code:
CI_Hooks
is called, followed by various CI classes, followed by a stack of classes specified in the hook class'
Code:
require_once
dependency chain.

When I try to access another custom class, it tells me [b]Fatal error: Cannot redeclare class .... [/b]

Is it possible to use require_once statements in a hook class to refer to library classes?

I can't simply use
Code:
CI load->library(className)
. My code need to be more flexible.

Any ideas would be greatly appreciated.

cheers,
Sherbo
#2

[eluser]sherbo[/eluser]
The problem seems to be that CodeIgniter is loading the library files twice. I can't figure out why.




Theme © iAndrew 2016 - Forum software by © MyBB