Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter Template Library on Mobile
#1

[eluser]demogar[/eluser]
Afternoon guys.

I'm using Phil Stugeons' Template library (which is great, btw) on a website at the moment. We needed two different layouts: one for the web/browser based website and another one for the mobile based website.

It was really easy to use different layouts, but the problem is with the different view files, since it wont autoload (depending on the user agent) the view file automatically, for example, if the user agent is a mobile wont analyze if the view is inside a /mobile/ folder (or something similar).

Reviewing the code, it seems the library doesn't try to do it. On line #759 we have this:
Quote:// Grab the content of the view (parsed or loaded)
$content = ($this->_parser_enabled === TRUE AND $parse_view === TRUE)

// Parse that bad boy
? $this->_ci->parser->parse($view, $data, TRUE)

// None of that fancy stuff for me!
: $this->_ci->load->view($view, $data, TRUE);

So it seems it will autoload the view directly. I could make a file_exists("mobile||web/" . $view) (etc..) and just load this, but I'm using Modular Extensions too in some cases, so it's not quite easy to do this dinamycally.

I think the only way to achieve this is by doing template, does anybody have a better idea?

Thanks in advance.

P.S.: Sorry my English, it's not my native language Smile


Messages In This Thread
CodeIgniter Template Library on Mobile - by El Forum - 10-09-2011, 02:52 PM
CodeIgniter Template Library on Mobile - by El Forum - 02-21-2012, 09:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB