PHP class extending another class outside of folder

Yeak picture Yeak · Jun 25, 2012 · Viewed 8.9k times · Source

I have a general class which i like to have it extended by other classes.

I have my directory set up with folders and class files inside of those folders for example

Classes/users/users.class.php classes/general/general.class.php

I have the users class extending the general class but since they are in different folders I guess the general class is not found.

class users extends general {

}

Can someone please help me out figuring this out.

I should also mention i am using autload function

Answer

René Höhle picture René Höhle · Jun 25, 2012

When you have no autoloader then include the class before.

Then the class is known and you can use it.

require_once(__DIR__.'/../general/general.class.php');