CodeIgniter Forums
wml and html templates - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: wml and html templates (/showthread.php?tid=24016)



wml and html templates - El Forum - 10-28-2009

[eluser]miauksius[/eluser]
Hello,

I'm planing to create a site for those people, that are surfing on the net with their cell phones, I'm talking about wap site. I want to make two templates: wml - for older phones, or for those people who counts traffic; html - for everybody else.

So, could you give me some tips? I want to do this in the easyest way

Sorry for my broken english and thank you for your help!


wml and html templates - El Forum - 10-28-2009

[eluser]Colin Williams[/eluser]
1.) Have two base folders within views: /wml/ and /html/ Each folder will have the same files, just different contents
2.) In your controller constructor, inspect the user agent string to determine the device. Using this determination, change a setting, like $this->base_dir, to 'wml/' or 'html/'
3.) Everytime you are loading a view, prepend $this->base_dir (e.g. $this->load->view($this->base_dir .'template', $data);