Welcome Guest, Not a member yet? Register   Sign In
interesting problem library classes loading (IMPORTANT)
#1

[eluser]C_O_S[/eluser]
hi eveybody,i want to ask a question about loading problem which our own classes in library folder.

i defined my own php classes in library folder and these classes is related with the other classes.Think about UML diagram.Every class is related with the other classes.For example,i have Video class and this video class extends the Content class.Although Content class and Video class is in same directory(library directory),i take an exception when i run my controller.i am loading library like this----> $this->load->library('video');
and create a new video object.
but i take an exception 'Content class is not found' in video.php on line ...

why i take that exception? every class is in same directory and i load necessary classes on my controller.

Please help me,this is realy important


#2

[eluser]InsiteFX[/eluser]
Maybe you should show what your doing and we could help you!

Telling us you got an exception is not telling us anything!
#3

[eluser]C_O_S[/eluser]
class Music extends Content_type{
...
}

class Content_type{
...
}

this two classes are in same directory (application/library)
when i load music class

...
$this->load->library('music');
$music=new Music();
...

Content_type class is not found on line 2 ,exception is coming.line 2 is begin that class music extends content_type...line

if i include the content_type.php file in music.php file,code will run successfully. but if i dont include content_type class --->content_type class is not found exception =) Althought this 2 classes are in same directory,why i have to include content_type class?
#4

[eluser]InsiteFX[/eluser]
CodeIgniter only loads it's classes it does not know anything about your class Content_type
Same as your video class it does not know where to find your Content_type class.

You could try autoloading it first, but usally you just do like you are doing and include it in your video class.

If you search the forums you should be able to find the autoload that Phil wrote.




Theme © iAndrew 2016 - Forum software by © MyBB