Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 248 trang
THÔNG TIN TÀI LIỆU
Cấu trúc
Cover
Copyright
Credits
About the Author
About the Reviewers
Table of Contents
Preface
Chapter 1: Introduction and Overview
Expected developer skills
Differences between PHP and JavaScript
What is jQuery
Why jQuery
How does jQuery fit in with PHP
How to work with the examples
Projects that use PHP and jQuery
WordPress
RoundCube
KFM
Drupal
Summary
Chapter 2: Quick Tricks
Dynamic select boxes
Client-side code
How it works
Server-side code
Quick deletes
Client-side code
Server-side code
Contextual help
Inline editing
Client-side code
Server-side code
Summary
Chapter 3: Tabs and Accordions
Using a jQuery tab plugin
Client-side code
Server-side considerations
Using jQuery accordion plugins
Client-side code
Server-side management of accordions
Client-side code
Server-side code
Just the conversion
Now show the data with the accordions
Server-side management of tabs
Server-side code
Just the conversion
Now show the data with the tabs
Using special codes to define tabs
Client-side code
Server-side code
Loading accordion panels through Ajax
Client-side code
Server-side code
Loading tab panels through Ajax
Client-side code
Summary
Chapter 4: Forms and Form Validation
Using the jQuery validation plugin
Client-side code
Setting up jQuery validation from PHP
Server-side code (setup)
Client-side code
Server-side code
Remote validation
Server-side code (setup)
Client-side code
Server-side code
Large select boxes
Client-side code
Server-side code
Auto-suggestion
Client-side code
Server-side code
Client-side code
Summary
Chapter 5: File Management
Security
Choosing a directory
Client-side code
Server-side code
Creating, renaming, and deleting
directories
Client-side code
Server-side code
Moving directories
Client-side code
Server-side code
File uploads
Client-side code
Server-side code
Renaming, deleting, and moving files
Client-side code
Server-side code
File downloads
Client-side code
Server-side code
Summary
Chapter 6: Calendars
Displaying the calendar
Creating an event
Client-side code
Server-side code
Loading events from the server
Client-side code
Server-side code
Moving and resizing events
Client-side code
Server-side code
Editing events
Client-side code
Server-side code
Deleting events
Client-side code
Server-side code
Walk-through of the calendar so far
Recurring events
Client-side code
Server-side code
Deleting recurring events
Client-side code
Server-side code
Summary
Chapter 7: Image Manipulation
Showing the list of images
Server-side code
Client-side code
Selecting an image
Client-side code
Server-side code
Preparing your PHP
Rotating
Client-side code
Server-side code
Caching or saving the image
Client-side code
Server-side code
Resizing
Client-side code
Server-side code
Cropping
Client-side code
Server side
Summary
Chapter 8: Drag and Drop
Sorting simple lists
Client-side code
Server-side code
Client-side code
Sorting trees
Client-side code
Server-side code
Connecting lists
Client-side code
Server-side code
Summary
Chapter 9: Data Tables
Setting up DataTables
Client-side code
Getting data from the server
Client-side code
Server-side code
Caching your database queries
Server-side code
Pagination through Ajax
Client-side code
Server-side code
Sorting by column
Filtering
Server-side code
Setting a delay on the filter
Summary
Chapter 10: Optimization
Optimizing the page load
Place scripts at the bottom
Aggregate and cache your scripts
Output HTML similar to the post-jQuery code
Optimizing development and
maintenance
Writing your own plugins
Un-caching your JavaScript
Optimizing jQuery
Use Google's CDN
Caching jQuery objects
Use $.load for non-visual code
JavaScript optimizations
Chaining
Speeding up selectors
Inject multiple elements at once
Using setTimeout
Use var for your variables
Summary
Index
Nội dung
[...]... here On my test server, my directory layout (within the public_html directory) is like this: /php_ and _jquery /php_ and _jquery/ jquery.min.js /php_ and _jquery/ jquery-ui.css /php_ and _jquery/ jquery-ui.min.js /php_ and _jquery/ 1-tests /php_ and _jquery/ 2-contextual_help [ others from various chapters ] /php_ and _jquery/ ckeditor /php_ and _jquery/ images /php_ and _jquery/ jquery-validate [ other plugins ] [ 14 ] This... recommend using PHP 5.2 or up You will also need to download the jQuery library from http://docs .jquery. com/Downloading _jQuery Who this book is for This book is for PHP application developers who want to improve their user interfaces through jQuery' s capabilities and responsiveness Whether you are familiar with jQuery or have only dabbled a little with JavaScript, this book will provide you with numerous... responsive interfaces—all with the minimum of code This is the first book in the market that will ease the server-side PHP coder into the client-side world of the popular jQuery JavaScript library This book will show you how to use jQuery to enhance your PHP applications, with many examples using jQuery' s user interface library jQuery UI, and other examples using popular jQuery plugins It will help... Now, without further ado, let's get on with the fun stuff Summary In this chapter, we discussed what jQuery is, why you would want to use it, and why is it useful to combine it with PHP We also saw a list of projects illustrating some uses for combining PHP and jQuery In the next chapter, we will look at a few examples of how you can use jQuery immediately to give your site a more "live" feel, without... end up with is a very clear piece of code, which can be understood immediately The problems of cross-browser compatibility are also solved by using the jQuery library You can be sure that the new script will work as planned in all major browsers The example links to the jQuery library file, jquery. min.js, which you can download from http://jqueryjs.googlecode.com/files /jquery- 1.3. 2.min.js Why jQuery? ... jQuery it is about how to work with both PHP and jQuery This book will teach you how to use jQuery to create some really cool effects, but without you needing to have in-depth knowledge of how jQuery works This material is copyright and is licensed for the sole use by JEROME RAYMOND on 30th October 2009 125 Louis ST, , So Hackensack, , 07606 Introduction and Overview With this book, we are more interested... Introduction and Overview Projects that use PHP and jQuery Here is a small list of projects that use jQuery along with PHP This illustrates the variety of uses that jQuery is put to WordPress WordPress (http://wordpress.org/) is probably the best-known blogging software on the net Recently, the admin dashboard area was given a thorough going over, and is now extremely flexible with the areas you can move around... this book covers Chapter 1, Introduction and Overview, introduces you to what jQuery is, why you would want to use it, and why is it useful to combine it with PHP Also, it gives a list of projects illustrating uses for combining PHP and jQuery Chapter 2, Quick Tricks, looks at a few quick examples on how to interface PHP and jQuery and a few tricks, which demonstrate how to relieve the most obvious resource... explain There is simply a select box for the country, with both the name and the id as country, and there is a placeholder table cell with the ID cities The real magic happens with the JavaScript How it works The main function in jQuery is called jQuery But most people use the common alias $ as it is already set up with the script and is much shorter In PHP, the $ symbol indicates that the following string... technology these days jQuery simplifies Ajax With pure Ajax, you need to do low-level stuff like create an XMLHTTPRequest object (taking care of cross-browser incompatibilities), set callbacks, check response values, and so on With jQuery, all you need to do is use $.get or one of the other jQuery JSON functions These functions will take care of the lowlevel stuff for you How to work with the examples . code 11 2
Renaming, deleting, and moving les 11 3
Client-side code 11 4
Server-side code 11 5
File downloads 11 6
Client-side code 11 6
Server-side code 11 7
Summary. events 13 2
Client-side code 13 3
Server-side code 13 4
Walk-through of the calendar so far 13 4
Recurring events 13 6
Client-side code 13 6
Server-side code 13 9
Deleting