Simple clear advice in plain English

Designing websites for mobile users

Decisions made when designing a website can cause a lot of work later on

Similarly, we can drop in the text-based navigation in the same way.

For some of the pages we use the brokenMobileBrowser function to tell people they can’t use a page from their phone.

That is because in the form we use hidden fields to pass some information back, including a form element that Dreamweaver added for us, which some mobile browsers reject. We could work around it by recoding bits of the page.

Where we’re going
The screenshot in the top left-hand corner of this page shows what one of the site users has suggested as a more iPhone-friendly look for the timer setting screen; thanks to Gavin Law, who created the mock-up with Joe Hewitt’s iUI tool.

There’s no doubt that this is a cleaner implementation of the form than the original web page, but it does look a little, well, iPhoney. So, while it would be possible to just give the form a makeover in this style, it wouldn’t fit with the rest of the site. So, how do you make an iPhone version? The answer is that you wouldn’t start from here.

It’s easy to create a new test in the moblib file based on the HTTP_USER_AGENT, which contains ‘iPod’ for both iPod Touch and iPhone. But then what? Joe Hewitt’s iUI provides useful stylesheets and scripts so, for instance, on/off options on web pages can have iPhone-like sliders to set them.

But if your code is anything like mine you’ll have to work that script into your existing code with a large set of PHP if statements. And, since many of the pag es were created originally by Dreamweaver, there’s a lot of database code at the top of each one, plus a little in the middle.

The simplest option is to design new pages that are optimised for the iPhone ­ and then, perhaps, to give users a preferences setting so they can choose if they want to view those by default, or the ‘real’ pages instead.

But what about all that code? Create another set of pages and you have double the number of queries and recordsets to worry about if you make any database changes.

One option is to take out the database code at the top of each file and turn it into a PHP include ­ you can do this fairly easily by copying and pasting and then simply adding a require statement, along the lines of

with a similar function in each page for its own database code. Then you can have iPhone or other specific versions of the page, but just one set of common database code to maintain. One problem doing this, however, is that you’ll probably break Dreamweaver’s drag and drop functionality for adding fields to the page ­ so don’t do it until you’ve got everything in place.

An alternative might be to strip out the guts of the page itself; leave the database code in place, and include a specific version of elements such as forms, optimised for the type of device on which they’re being displayed.

Reader Comments

   

Add your comment

All fields must be completed. Your email address will not be displayed or used to send marketing messages.

All messages will be checked by moderators before appearing on the site.

See our Privacy Policy for more information.

Related articles

Hands on: Indices and mapping

How to control the way your site is indexed by search engines

Hands on: Organise your website's information

Make your site easy to navigate with any browser, and confound overseas spammers

Web development - Site under construction

Tim Anderson begins a new Hands On series with an introduction to dynamic web site development.

Question & Answer

Q.Why are some of the keys on my keyboard doing strange...

> Read the answer

Q.Is my phone’s Bluetooth any use?

> Read the answer

Q.Can I switch boot drives so that I can work on older...

> Read the answer

Best deals on the web

img

Samsung RV520-A07

£359.98- Buy it now

img

Acer Aspire 5750G (LX.RXP02.019)

£399.99- Buy it now

img

Apple MacBook Pro (MD313B/A)

£904.37- Buy it now

Latest issue & subscription deals

Poll

Are you concerned about viruses that target mobile phones?

Jargon Buster

Computing terms explained in plain English

Restore point

A Windows backup of system files and settings.

Great shopping deals from Computeractive