views:

235

answers:

2

I am building a series of forms, and I am trying to inherit the functionality of a parent Form class into all the forms. For example,

LeaveForm extends Form (Model)

LeaveFormController extends FormController

I am handling all the leave form specific stuff in LeaveFormController and LeaveForm.

In LeaveFormController constructor, I simply call the parent class constructor, then load the LeaveForm Model.

And in FormController constructor, I load Form model.

My problem is, I get an error, "Cannot redeclare class form in Form.php"

Have I got my architecture wrong?

How do I handle this ?

Any help would be highly appreciated.

Thanks..

A: 

Maybe this or this? Also I would suggest making a new thread on the Codeigniter's forums

vladikoff
A: 

check if the class has already been initialized like this:

if (!class_exists('classname')) { // ok fine create new instance now }

Sarfraz