A slicker look, for sure, but how much work is it to implement on an existing site?
R E L A T E D   C O N T E N T
ADVERTISEMENT

Designing websites for mobile users

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

Nigel Whitfield, Personal Computer World 14 May 2009
ADVERTISEMENT

Judging by the emails I receive, quite a few readers are clearly interested in mobile websites.

We’ve talked about how to optimise sites in various ways, along with some of the dos and don’ts.

One aspect of mobile site optimisation is whether or not you should do it at all ­ – a topic that’s discussed in ‘To mobi or not to mobi?’ below.

Arguments can be made either way, but below I’ll be looking at how to handle the practical aspects of updating your site.

Where we are
The particular set of pages that I’m considering updating allow visitors to my site to remotely program their digital TV recorder, either to search the EPG (electronic programme guide) for a specific programme or to set a recording for a specific date, time and duration. It’s the only section of the site that’s designed for mobile use, because it’s the section most likely to be used when you’re mobile.

The site’s coded in PHP and all the pages in the section rely on a function that’s in a library file called moblib.php, which is where I’ve put things relating to mobile access.

But iPhone users need something a bit more sophisticated; the text links might not be so easy to see and, further down the screen, larger options on the form will be useful as well.

How do we get this far? Well, this is part of what’s in our mobile library:

function isMobile() {
returnpreg_match(‘/Symbian|MIDP|Nokia|SonyEriccson|UP.Browser|Smartphone|iPod/’,$_SERVER[‘HTTP_USER_AGENT’]) ;
}
function brokenMobileBrowser() {
// some browsers don’t seem to populate hidden form fields
returnpreg_match(‘/SEMC-Browser/’,$_SERVER[‘HTTP_USER_AGENT’]) ;
}

In the pages within this section of the site there are a few simple tests. The isMobile function is used to choose which style sheet to load, and reversed to turn on the <DIV> tags that are needed for the main layout and to load the contents of the side navigation panels, like this:

<?php if ( ! isMobile() ) { ?>
<div id=”masthead”>
<div align=”center”><ahref=”../index.php”>< imgsrc=”../images/timerbar.jpg” alt=”Go back to home page” width=”700” height=”100” border=”0”></a></div>
</div>
<div id=”mainnav”>
<?php require(‘../navleft.php’) ; ?>
</div>
<div id=”bodytext”>
<?php } ?>


All Software Applications
Tags: Hands-on, Web-development

Like this story? Spread the news by clicking below:

Post this to Delicious del.icio.us    Post this to Digg Digg this    Post this to reddit reddit!

Permalink for this story
R E A D E R   C O M M E N T S
M A R K E T P L A C E
Get your free demo of Numara Track-It! 8 - the leading help desk solution for IT related issues.
Make presentations, review documents & share your entire desktop. 30-day free trial! (cc required).
Discover how remote support can fuel your IT business in ways you've never thought of before.
Apply ITIL best practices at your service desk while eliminating integration cost. Learn more here.
WAN based, automated, daily vulnerability assessments. Click here to try and request our whitepapers.
Have your product or service listed here >   
Sponsored links
F E A T U R E D   J O B S
| Randstad Technologies
Project Manager required to join fast-growing IT software house in the Bristol area. We are looking for candidates with strong Project Management skills looking to better their skills with a market-leader offering long-term progression. The ... more >
| Computer People
My client is looking for an ETL Developer to identify, prioritise and develop new ETL packages and maintaining existing packages. Delivering, maintaining and testing ETL solutions. Investigating new technology platforms and technologies. Documentation of ETL ... more >
| Computer People
Computer People are currently recruiting for a large and rapidly expanding IT Services company that are looking to add to it’s talented ITIL Change Management function within their Central Service Center based in Milton Keynes. ... more >
| Computer People
Web amp; SQL, Crystal Reports, .NET (C# amp; reputation in the Market. They seek a creative Developer with PHP experience to join their team. We are looking for someone who has a strong understanding of ... more >
More job opportunities