CodeIgniter Forums

Full Version: Class Destructor usage in a Controller - can anyone see problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]jdav3579[/eluser]
Hi,

I have code that is repeated of loading a frame view or wrapper view at the end of each controller method which is passed the data for the page.

I want to define page content in a variable by each controller and then write a single destructor that will just load the appropriate wrapper view and put the data in it.
Can anyone see a problem with doing this? I currently define the data as a constant and use a hook to put the data in.

I would also prefer if the above is possible to put it all into a MY_Controller, so the code is written once for all constructors that extend the class.

Is this possible /Wise?

Cheers
John