Welcome Guest, Not a member yet? Register   Sign In
cleanest way to implement the main layout
#1

[eluser]Lunaticon[/eluser]
Hey Guys,

I've been working with CodeIgniter for a while now and I think my software design isn't that bad. I've got just a tiny question which has to do with the implementation of a certain view.

I use a main layout and I'm just chaning the content of it.
Code:
class Testcontroller extends App_Controller{
   public function testmethod(){
      ...
      $testdata = array("Hi", "Bye");
      $this->data['content'] = $this->load->view('any_view', $testdata, true);
      $this->load->view('main_layout', $this->data);
   }
}

Thats the way I implement it currently. The problem is I have to load the main layout in every of my controller methods. I tried using the descrutor of my own controller of which all the other controllers are inheriting from. But as you may imagine it doesn't work properly.

So my question is: Is there really no way to avoid implementing that line in every of my controller methods? or is there a clean way to realize this?

Thanks in advance,
Lunaticon


Messages In This Thread
cleanest way to implement the main layout - by El Forum - 04-06-2011, 02:50 PM
cleanest way to implement the main layout - by El Forum - 04-06-2011, 03:47 PM
cleanest way to implement the main layout - by El Forum - 04-06-2011, 05:29 PM
cleanest way to implement the main layout - by El Forum - 04-14-2011, 03:51 PM
cleanest way to implement the main layout - by El Forum - 04-14-2011, 10:35 PM
cleanest way to implement the main layout - by El Forum - 04-14-2011, 11:48 PM
cleanest way to implement the main layout - by El Forum - 04-15-2011, 09:20 AM
cleanest way to implement the main layout - by El Forum - 04-15-2011, 01:15 PM
cleanest way to implement the main layout - by El Forum - 04-15-2011, 05:14 PM
cleanest way to implement the main layout - by El Forum - 04-15-2011, 05:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB