WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this Article to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES SUBMIT AN ARTICLE PRINT
Title : Honey, I Shrunk My Website
Categories : PHP, PHP options/info, Site Planning, Other
Keith Reichley
Keith Reichley
Date : 2001-07-01
Grade : 0 of 5 (graded 0 times)
Viewed : 5016
Search : More Articles by Keith Reichley
Action : Grade This Article
Tools : My Favotite Articles


  Submit your own code examples 
 


Small is good, if you want to make your website content available to users of PDAs (personal digital assistants). Although PDA hardware and software capabilities can't match those of a desktop machine, you don't need to settle for an anemic handheld version of your site. With careful planning and smart coding you can create an elegant PDA-friendly site.



This article shows you how to to join the bleeding edge with minimal risk and effort. I'll focus on using AvantGo (http://www.avantgo.com) as the delivery mechanism, though the much of the information here can be applied to alternative PDA browser solutions (see below).



AvantGo provides users with free browser and syncing software. For the developer, there's a quick online tool for building the AvantGo channel to which users can subscribe. All in all, AvantGo is truly a killer app for PDAs.



Decide What to Publish

Your first step is to decide what to deliver to your PDA-equipped audience. Start small and be selective. News stories, articles, product descriptions and order forms are good candidates for a channel's timely content.

You want a simple 2-3 level navigation, such as a main menu, submenus (optional) and content pages. For example, our WEBtheJOINT channel (http://www.webthejoint.com/jump.php?id=18) consists of two levels - a main menu of articles, and the articles themselves.

Keep the sum total of your pages to 50-100KB in size. AvantGo enforces limits of 256KB per channel, 32KB per page. Pages should be short and limited to one subject.





Coding Basics

AvantGo supports HTML 3.2 -- with exceptions. Forget about using frames and image maps. Image tag attributes like height, width, and text floating won't fly either. Text formatting capabilities are limited. The FONT and BASEFONT tags are useless.

Keep screen size in mind. You can design your pages for the lowest common denominator (Palm's 150 x 150 of usable screen). Or, you can use an HTTP Header (described in the next section) to adapt your content to fit the larger screens of Windows CE and HPC Pro devices.

With PDAs' limited graphics capabilities your safest bet is to use high-contrast grayscale images with a width of 150 pixels or less. Color images will be converted to grayscale by non-color devices. Be sure to use alt tags.

For more detail on these topics read the AvantGo Developer Guides (https://avantgo.com/developer/reference/).



Using HTTP Headers

Once you've identified your channel's content-to-be, you face the prospect of optimizing it for the PDA. You can create separate versions for the standard browser and for PDAs, but the experienced developer may prefer to use JavaScript, PHP or another scripting tool to optimize pages on-the-fly. Use HTTP Headers to determine the client's operating system, screen size, color capabilities, and more.

For our channel, we use PHP simply to determine whether the user's browser is "AvantGo". If it is, a downsized header file (PDA_header.inc) containing the HTML for one small image and a few navigational links is called, rather than the full-blown header (FULL_header.inc) that our regular site's visitors see:


<?php
$agent
= getenv("HTTP_USER_AGENT");
$handheld = strpos($agent, "AvantGo") ? "Yes" : "No" ;
if(
$handheld == "Yes")
{
include(
"../PDA_header.inc");
} else {
include(
"../FULL_header.inc");
}
?>


Visit http://www.webthejoint.com/jump.php?id=23 for the full scoop on using HTTP Headers.



Create Your Content

Design a small home page that gives the visitor a clear idea of what lies beneath. A main menu is good. Second and lower level content can either be created from scratch, or existing pages can be scripted with HTTP Headers as described above to eliminate the need for separate PDA-friendly versions.

Save the home page file and any other new or modified files on your web server. Consider putting the home page file into a separate subdirectory with header, footer and image files used solely for your AvantGo channel.



Using Forms

Any website worth the cyberspace it occupies has some interactivity via forms. AvantGo and PDAs can handle just about any kind of form. Be sure to keep in mind screen size and the HTML limitations mentioned previously.

The form that your user fills out and submits on the PDA is saved in the Forms Manager. The next time the user syncs to your channel, AvantGo sends the completed form to your server where it is processed as usual by your form's cgi-bin or other action.

The only major change you need to make to the form is to customize the Submit button with a little JavaScript. Replace the standard:


<input type="button" name="submit" value="Submit"
onClick="document.forms[0].submitNoResponse(
'This is the message that will be displayed after form
submission',
false,
true);
back()">


The submitNoResponse function is AvantGo's way of displaying a confirmation message to the user, and of specifying whether the form is hidden in the Forms Manager (in this example, "false") and whether multiple forms can be submitted ("true").

A powerful AvantGo feature is channel personalization with forms and cookies. For more information visit http://www.webthejoint.com/jump.php?id=25.



Create Your AvantGo Channel

If you haven't already done this, sign up for a free AvantGo account. Next, use AvantGo's wizard (https://avantgo.com/mydevice/channel_wizard/url.html) to create your channel. You'll specify the location of your home page, link depth, and more. This should take all of five minutes.

When finished, click on "Export Channels" to generate the URL that you can copy and post on your site so that customers can sign up for your channel. The URL will look like this:

http://avantgo.com/mydevice/autoadd.html?title=WEBtheJOINT&url=http%3A%2F%2Fwww.webthejoint.com%2Favantgo%2Findex.php&max=100&depth=2&images=1&links=0&refresh=always&hours=1&dflags=127&hour=16&quarter=30&s=00

It ain't pretty, but it works like a charm. When you go to this URL the channel will be added to your "My Channels" list. Sync up your PDA, then click the AvantGo icon on your PDA to test your handheld-friendly site.

If you're sans PDA, don't worry. Download the Palm OS Emulator onto your Windows/Mac/Unix computer (http://www.palmos.com/dev/tech/tools/emulator/).



Alternative PDA Browser Solutions

AvantGo's not the only game in town, but it's way ahead of whatever's in second place.

Blazer: Palm browser that can access virtually any site on the web, but strips out unsupported content (streaming media, Java, JavaScript). Unlike AvantGo, Blazer does not store content on the PDA. Cost: US$19.95 http://www.handspring.com/software/blazer_overview.jhtml

Palmscape: Palm browser that can cache pages for offline viewing. No SSL support. Cost: US$29.95 http://www.ilinx.co.jp/en/products/ps.html

Web Clippings: Stand-alone applications supported by Palm VII handhelds, Palm Vs with the OmniSky modem, and other handhelds with the Mobile 1nternet Kit installed. http://www.palmos.com/dev/tech/webclipping/.



What Are You Waiting For?

If you haven't already, sign up for a free AvantGo account. Subscribe to several channels -- you'll quickly find some with elegant navigation and valuable content. Yours could be one of them. Give it a shot.









Developing a Security Policy, by Anna Johnson
Categories : Other, Security, Site Planning
Some more about "Doorway" pages...
Categories : Search Engines, Search, Site Planning, Other
Creating Auto-incrementing ID Fields with PHP and Oracle
Categories : PHP, PHP options/info, Databases, Oracle
Emergency Response Part 2 of 2
Categories : Other, Site Planning, Security
Search engine strategies - part 5: More Keywords
Categories : Site Planning, Other
Search engine Strategies - part 6: Links
Categories : Other, Search Engines, Site Planning
Search engine strategies - If you build it, will they come? - Part 1
Categories : Other, Site Planning, Search Engines
Descriptions of Common Data Types
Categories : MySQL, Databases, PHP, PHP options/info, General
Sending Mail Using Flash 4 and PHP
Categories : PHP, PHP options/info, Flash
Search Engine Strategies - part 4: Choosing Keywords
Categories : HTML, Other, Site Planning, Search Engines
Keep your Banner Waving
Categories : PHP, PHP Functions, Miscellaneous, Site Planning, Utilities
Doorways to Traffic
Categories : Search Engines, Search, HTML, Site Planning, Other
Copyright Law May Not Be Best Way to Protect Your GUI
Categories : Other, Site Planning
Generating One-Time URLs with PHP
Categories : PHP, URLs
The Search Portals are going through some growing pains
Categories : Search Engines, Search, Site Planning