J rn Zaefferer is a professional software developer from

J rn Zaefferer is a professional software developer from Cologne, Germany. He creates application programming interfaces (APIs), graphical user interfaces (GUIs), software architectures, and designs databases, for both web and desktop applications. His work focuses on the Java-platform, while clientside-scripting evolves around jQuery. He started contributing to jQuery in mid-2006, and has since co-created and maintained QUnit, jQuery’s unit testing framework; released and maintained a half-dozen of very popular jQuery plugins, and contributed to jQuery books as both author and tech-reviewer. He also is a lead developer for jQuery UI.

About the Reviewers Marc Grabanski got involved early

About the Reviewers Marc Grabanski got involved early on with jQuery by authoring what would become the jQuery UI Datepicker. He works, arguably too much, building user interfaces and web software all the day long with his company MJG International. If I were to thank anyone it would be Jesus Christ for transforming me from a video game addict into something useful to society and the people around me. Akash Mehta is a web application developer and technical author based in Australia. His area of work covers e-learning solutions, information systems, and developer training. He regularly writes web development articles for Adobe, CNet, the APC Magazine, and other publications in print and online. He is a regular speaker at IT conferences, user groups, and BarCamps. Currently, Akash provides web development, technical writing, consulting, and training services through his website, http://bitmeta.org/. I would like to thank my parents, for their constant support and encouragement, and Sophie, for her enduring patience and amazing inspiration.

About the Author Dan Wellman lives with his

About the Author Dan Wellman lives with his wife and three children in his home town of Southampton on the south coast of England. By day his mild-mannered alter-ego works for a small yet accomplished e-commerce production agency. By night he battles the forces of darkness and fights for truth, justice, and less intrusive JavaScript. He has been writing computer-related articles, tutorials, and reviews for around five years and is rarely very far from a keyboard of some description. This is his third book. I’d like to thank the Packt editorial team, all of the technical reviewers and the jQuery UI team, without whom this book would not have been possible. Special thanks go to J rn Zaefferer who provided essential feedback and was always happy to answer my late-night, niggling questions. Thanks also to my fantastic friends, in no particular order; Steve Bishop, Eamon O’ Donoghue, James Zabiela, Andrew Herman, Aaron Matheson, Dan Goodall, Mike Woodford, Mike Newth, John Adams, Jon Field and Vicky Hammond and all the rest of the guys and girls.

Credits Author Dan Wellman Reviewers Marc Grabanski Akash

Credits Author Dan Wellman Reviewers Marc Grabanski Akash Mehta J rn Zaefferer Acquisition Editor Douglas Paterson Development Editor Nikhil Bangera Technical Editors Vinodhan Nair Gagandeep Singh Indexer Rekha Nair Editorial Team Leader Gagandeep Singh Project Team Leader Priya Mukherji Proofreader Claire Cresswell-Lane Graphics Nilesh Mohite Production Coordinator Shantanu Zagade Cover Work Shantanu Zagade

jQuery UI 1.7 The User Interface Library for

jQuery UI 1.7 The User Interface Library for jQuery Copyright 2009 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: November 2009 Production Reference: 1021109 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-847199-72-0 www.packtpub.com Cover Image by Vinayak Chittar (vinayak.chittar@gmail.com)

416 CHAPTER 13 CASE STUDY: USING PHP (Web site translator)

416 CHAPTER 13 CASE STUDY: USING PHP FOR AN XML APPLICATION Summary In this chapter, I worked through an application that uses PHP, MySQL, XML, and XSLT to display and manage weather content. The application stores all of the data within a MySQL database. The application retrieves the relevant database records with PHP 5. It uses the new PHP 5 DomDocument object to generate the XML document. The structure of the generated XML documents is flexible enough to cope with several different scenarios. In order to display the XML content within the application, I used XSLT stylesheet transformations to generate XHTML. You saw how to use XSLT variables and include conditional logic in the stylesheets. This chapter wraps up the book. I hope you ve enjoyed reading about XML and that you ve expanded your knowledge. XML is a flexible approach to building both client- and server-side web applications, and I hope the contents of this book will make you as enthusiastic about XML as I am!
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

CHAPTER 13 CASE STUDY: USING PHP FOR (1 on 1 web hosting)

CHAPTER 13 CASE STUDY: USING PHP FOR AN XML APPLICATION 415 addweather.php The final part of the application processes the weather details entered by users and adds the content to the database. As I mentioned earlier, the database stores all values in Celsius degrees. The page addweather.php starts with a conversion function that converts Fahrenheit temperatures to Celsius: Figure 13-7 earlier in the book shows how the completed application appears when viewing the weather for a city.
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Web host server – 414 CHAPTER 13 CASE STUDY: USING PHP


The stylesheet also includes a form so users can add a new weather report:

Add a new entry:

The form needs to pass the current city id, so the application can store the value in the database: <input type=”hidden” name=”city” value=” ” /> The rest of the form provides appropriate inputs as well as a drop-down list showing the different weather types: Temperature is in:

We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

CHAPTER 13 CASE STUDY: USING PHP FOR (Apache web server)

CHAPTER 13 CASE STUDY: USING PHP FOR AN XML APPLICATION 413 The stylesheet needs to check the value of the $numTemp variable. If the value is 0, there are no weather records, and it will display an appropriate message: There are currently no entries for If the value isn t 0, there are weather details that the stylesheet can display. As I m writing this from Australia, I use the Celsius temperature scale. The database stores the temperatures in Celsius, but the application needs to display both Celsius and Fahrenheit values. The stylesheet converts the existing Celsius temperatures to Fahrenheit values and stores them in variables: The stylesheet displays the weather outlook using images designed by Gavin Cromhout. You can find them in the imagesfolder. It chooses the images in the following way: Outlook:
<img src=”images/ .jpg” width=”100″ height=”80″ . alt=” ” />
It then displays the minimum and maximum temperatures in a table:

You want to have a cheap webhost for your apache application, then check apache web hosting services.