Welcome Guest, Not a member yet? Register   Sign In
$this->load->view_mobile("mypage") ?
#1

[eluser]albertleao[/eluser]
Hello all,

I believe you can do this via extending the controller? But as of right now, my desktop app usually just has to load a view because it's mostly ajax calls.

I've been using jquery mobile and I need to reload my pagehead and footer and stuff every request so my code when from looking like this:

Code:
function page() {

$this->load->view(mypage);

};


To this

Code:
function mobile_page(){

$this->load->view(pagehead);
$this->load->view(pageheader);

$this->load->view(mypage);

$this->load->view(pagefooter);
$this->load->view(pagefoot);
}

I would like to create a function so I can just say

Code:
$this->load->view_mobile(mypage);

and it will get the "mypage" argument and output what I need for mobile. Whats the best way to do this?
#2

[eluser]Otemu[/eluser]
Sounds like you need to use a master template page, check out this previous post with solution that I provided
http://ellislab.com/forums/viewthread/231424/

Basically the concept is that your have a template page which would load your pagehead,footer and then you could just load the content within the template.

Is that what your looking for??
#3

[eluser]albertleao[/eluser]
I had thought about doing templating but almost all of my views are heavily dependent on model functions that are being called constantly. Is there a templating class that would also make those calls for me?
#4

[eluser]Otemu[/eluser]
If ti the case you need separate modules, then you should check out hmvc

Modular Extensions makes the CodeIgniter PHP framework modular. Modules are groups of independent components, typically model, controller and view, arranged in an application modules sub-directory that can be dropped into other CodeIgniter applications.

I haven't tried any of the template libraries, I use my own simple template system and just use hmvc.

If every page is going to load the same models then you should use my_controller and all your classes can then extend this.




Theme © iAndrew 2016 - Forum software by © MyBB