Book Image

PHP and script.aculo.us Web 2.0 Application Interfaces

By : Sridhar Rao Chivukula
Book Image

PHP and script.aculo.us Web 2.0 Application Interfaces

By: Sridhar Rao Chivukula

Overview of this book

<p>script.aculo.us is a JavaScript library that provides dynamic visual effects, user interface controls, and robust AJAX features. It is to client-side what PHP is to server-side &ndash; powerful, simple, complete fun, and above all, a MUST! As developers, we all dream of building applications that users can instantly fall in love with and get productive. Simple and niche applications are the future of web applications. script.aculo.us when used with PHP as a server-side scripting language, can give us a new way of looking at things and changing the way we work.<br /><br />script.aculo.us provides you with easy-to-use, cross-browser user interface JavaScript libraries to enhance your web sites and web applications. It provides dynamic visual effects, user interface controls, and robust AJAX features. This book covers all aspects for a developer to learn and master the art of using advanced JavaScript also referred to as 2.0 aspects in PHP web applications. script.aculo.us is an effective and powerful add-on to the Prototype library and when combined with PHP, it can make a lot of difference. The difference every developer dreams of.<br /><br />This book has been written keeping in view every basic step as well as covering the most complex aspects while writing our applications &mdash; from simple effects, to the AJAX way of communicating through systems in applications. It gives you a completely new way of adding interactivity to your web applications. You will learn how sript.aculo.us provides interactivity and beauty to your project so that it engages users and appeals to the masses.<br /><br />Faster, more efficient, and more productive applications are what we are trying to build. Each chapter of this book has been hand-crafted to make sure that you as a developer can learn and master the art of making beautiful applications.<br /><br />The book covers all the various aspects of script.aculo.us with a few real-world clone projects, which will surely help you explore your creative side.<br /><br />The aim of this book is to make you go "WOW"!</p>
Table of Contents (18 chapters)
PHP and script.aculo.us Web 2.0 Application Interfaces
Credits
About the author
About the reviewers
Preface

Selecting the products to buy


We have a user management system and our user wants to select the products to buy. We all know Jenny. She just can't wait to buy her new handbag.

Let's do a simple memory test here. Check out the following screenshot and see if you find it familiar:

There you go! Yes, we made this module in Chapter 5 while learning the drag and drop feature of script.aculo.us.

Here, we are going to integrate the same module with our application. We will be using the same code and we will add our PHP sessions to make sure that only a registered and logged-in user can access and buy the products.

<?PHP
session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
header ("Location: login.php");
}

We ensured that this page can be accessed only by the users who are logged in. We have created three products and have made them draggable.

Note

When dealing with data about products coming from database, you may need to change certain JavaScript code to make...