2009/12/2 11:57:40
|
---|
|
Mobility Support a quick how to.I get a lot of people asking me how to do themes and templates for mobile phones - and by the time they get to me with the question they are often so frustrated that they are ready to give it all up.
Well, it doesn't have to be that way - and I will show you here how friggin easy it is. Especially for newer smartphones - like the iphone. Let's start in your theme folder. rename theme.html to web.html and create a new blank file called theme.html. in the new theme.html paste the following snippet of code <{php}> if (stristr($_SERVER['HTTP_USER_AGENT'],'iPhone')) { include 'iphone.html'; } else { include 'web.html'; } <{/php}> save it - and create a new file called iphone.html you now have the ability to fully code out a custom theme for your iphone visitors without any need for a module - or core hacks of any kind. Moreover you can do this for any user agent and it will work flawlessly if the user agent is reported. If the user agent is not reported it will default to web.html. This will also work in template files - so if you have an issue with the way your forums display on iphone - just make a web_template.html and an iphone_template.html and use the code above to trigger which is loaded from the original template. This couldn't get more simple - but on large sites - it can prove to be a lot of work. However - you could not ask for more control over your site than with this approach. Anyway - i hope this helped some of you :) |
2009/12/2 12:22:26
|
---|
|
Re: Mobility Support a quick how to.uhp - someone just pointed out something to me:
How the hell do I figure out what User Agent something uses? Well... there are lots of sites out there dedicated to compiling user agent lists... but a site that i stumbled on that is really cool is http://www.handsetdetection.com/devices/properties because they have more than just the user agent listings - they also have a table that tells you what each phone is capable of - for example... can a _BLANK_ phone handle ajax? They provide a paid service to do what we are talking about - I in no way am telling you not to use a paid service - I have no experience with it because I have always just done it by hand based on the needs of my clients. good question, I hope my answer helped. |
2009/12/2 13:51:20
|
---|
|
Re: Mobility Support a quick how to.How to check the user’s browser type and platform
Full Featured PHP Browser Detection & OS Detection Tutorial about Detecting User Agent Types and Client Device Capabilities Edited by UnderDog on 2009/12/5 0:58:30
|
_________________
Which modules are you using? | Dedicated Module Team | ImpressCMS is Redesigning their sites, Join the discussion! |
2009/12/2 18:14:44
|
---|
|
Re: Mobility Support a quick how to.Thanks, very handy.
|
2009/12/3 2:34:43
|
---|
|
Re: Mobility Support a quick how to.Nice Will!
Would be cool if you could create a blog post with this content Great job ! |