Reply New Topic
2009/12/2 11:57:40
Home away from home

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

if (stristr($_SERVER['HTTP_USER_AGENT'],'iPhone')) {
include 'iphone.html';
else {
include 'web.html';

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
Home away from home

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 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
Home away from home

Re: Mobility Support a quick how to.

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
Home away from home

Re: Mobility Support a quick how to.

Thanks, very handy.

2009/12/3 2:34:43
Home away from home

Re: Mobility Support a quick how to.

Nice Will!

Would be cool if you could create a blog post with this content

Great job !

Marc-André Lanciault
Founder and CEO INBOX International inc.
Co-Founder ImpressCMS

Reply New Topic extras
 Previous Topic   Next Topic
You can view topic.
You can start a new topic.
You can reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You can post without approval.