Welcome Guest, Not a member yet? Register   Sign In
Construct & destruct - quick question
#1

[eluser]hightower[/eluser]
I'm just starting with CI, and it is my first framework so I'm still getting new to it. I have a quick question though. Does it provide a destruct function similar to that in procedural PHP?

Code:
function __construct()
{
}

function __destruct()
{
}

The reason I ask is because I would want to do something like this:

Code:
class Welcome extends Controller()
{

    function Welcome()
    {
        $this->load->view('header');
    }

    function index()
    {
        $this->load->view('content');
    }

    function something_else()
    {
        $this->load->view('something_else');
    }

    function __destruct()
    {
        $this->load->view('footer');
    }

}

I've tried using the __destruct function shown in the above example, but I believe this is carried out after the view has been made so therefore doesn't work. Is there anything that would achieve this so it becomes part of the view?

It's not a priority, just a little thing that would be nice to save me loading the footer everytime.

Thanks Smile


Messages In This Thread
Construct & destruct - quick question - by El Forum - 06-29-2009, 07:28 AM
Construct & destruct - quick question - by El Forum - 06-29-2009, 07:36 AM
Construct & destruct - quick question - by El Forum - 06-29-2009, 07:38 AM
Construct & destruct - quick question - by El Forum - 06-29-2009, 07:47 AM
Construct & destruct - quick question - by El Forum - 06-29-2009, 08:01 AM
Construct & destruct - quick question - by El Forum - 06-29-2009, 08:48 AM
Construct & destruct - quick question - by El Forum - 06-29-2009, 08:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB