Open GoogleCodeExporter opened 9 years ago
If I know where php "redirects" the browser to the template, I think I can
write a template in iUI or iWebkit.
Original comment by blazike...@gmail.com
on 25 Jan 2011 at 9:02
I think that functionality is buried somewhere in the Code Igniter
functionality. I try to have a look at it later. It has to apply before the
actual theme got loaded.
Original comment by carsten....@gmail.com
on 26 Jan 2011 at 5:43
I guess the Home controller should do this, before loading the actual page:
http://code.google.com/p/lifepress/source/browse/system/application/controllers/
home.php
Need to find the line number where the theme gets loaded, that's where another
path has to be introduced. The problem would be to get the browser
identification at that place... but maybe CodeIgniter is prepared for that.
Original comment by carsten....@gmail.com
on 26 Jan 2011 at 5:46
Well, I think just examining the user agent would work, so
if (strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') ||
strstr($_SERVER['HTTP_USER_AGENT'],'iPod') ||
strstr($_SERVER['HTTP_USER_AGENT'],'iPad')) {
// redirect to '/views/iphone/' . $mobiletemplatechosen (Why not putting in the admin panel a box for selecting mobile template too?
}
However, this is for iOS devices, for Android I think I'll need their user
agent (and maybe something like webkit). I'll google for that.
Original comment by blazike...@gmail.com
on 26 Jan 2011 at 12:30
I looked at home.php, but I can't understand what it does :°D
Original comment by blazike...@gmail.com
on 26 Jan 2011 at 12:32
Yes, the user agent is the way to decide to switch to a mobile view. But
because Lifepress supports themes, we have to switch *before* the current theme
gets loaded. I don't know the exact point where it happens right now, but I'll
take a deeper look when I get home.
The Home controller was only my first thought. Reading
http://philsturgeon.co.uk/news/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY
I still think it's the right way to extend the CodeIgniter classes. Especially
this code (taken from the mentioned article) is a pointer to the right way:
// If the user is using a mobile, use a mobile theme
$this->load->library('user_agent');
if( $this->agent->is_mobile() )
{
/*
* Use my template library to set a theme for your staff
* http://philsturgeon.co.uk/code/codeigniter-template
*/
$this->template->set_theme('mobile');
}
Original comment by carsten....@gmail.com
on 26 Jan 2011 at 1:58
I found in
http://www.google.com/codesearch/p?hl=en#iMcFnzoy-nI/system/application/librarie
s/sweetcron.php&q=item%20theme%20package:http://lifepress\.googlecode\.com&sa=N&
cd=15&ct=rc some code:
$this->CI->load->view('themes/'.$this->CI->config->item('theme').'/_header', $data);
$this->CI->load->view('themes/'.$this->CI->config->item('theme').'/single',
$data);
$this->CI->load->view('themes/'.$this->CI->config->item('theme').'/_footer',
$data);
I'll read the article and http://philsturgeon.co.uk/code/codeigniter-template,
it seems interesting.
Original comment by blazike...@gmail.com
on 26 Jan 2011 at 3:43
Original issue reported on code.google.com by
carsten....@gmail.com
on 13 May 2010 at 5:15