tags:

views:

10

answers:

1

from javascript i request for a php file. and this php file will call a model that extends a super_model.

i wonder where i should include this super_model. in the php file (which acts like a controller) or in the model?

i've got other models too, should i include the super_model they all extend in the controllers that are calling them, or in the models above the class function?

+1  A: 

You should look up the php __autoload function, that way you don't even need to worry about when to include the file. Also, I'd use include_once(), as it'll make sure the file is only included once (as long as the file your including only has class or function definitions, this is the way to go).

As far as your specific question goes, if you're not going to use __autoload, I'd always include_once() the parent in the child class's definition.

Mike Sherov