1. Trang chủ
  2. » Công Nghệ Thông Tin

1653 jquery 1 3 with PHP

248 106 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 248
Dung lượng 5,07 MB

Nội dung

www.it-ebooks.info jQuery 1.3 with PHP Enhance your PHP applications by increasing their responsiveness through jQuery and its plugins Kae Verens BIRMINGHAM - MUMBAI www.it-ebooks.info jQuery 1.3 with PHP 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, Packt Publishing, nor its dealers or 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 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: October 2009 Production Reference: 1211009 Published by Packt Publishing Ltd 32 Lincoln Road Olton Birmingham, B27 6PA, UK ISBN 978-1-847196-98-9 www.packtpub.com Cover Image by Louise Barr (lou@frogboxdesign.co.uk) www.it-ebooks.info Credits Author Editorial Team Leader Kae Verens Gagandeep Singh Reviewers Project Team Leader Akash Mehta Lata Basantani Ashok Modi Project Coordinator John K Murphy Srimoyee Ghoshal Acquisition Editor Proofreader Douglas Paterson Chris Smith Development Editor Darshana D Shinde Technical Editor Ishita Dhabalia Copy Editor Sanchari Mukherjee Indexer Rekha Nair Production Coordinator Dolly Dasilva Cover Work Dolly Dasilva www.it-ebooks.info About the Author Kae Verens lives in Monaghan, Ireland with his wife Bronwyn and their two kids Jareth and Boann He has been programming for twenty years, fifteen of which were as a professional Kae started writing in JavaScript in the mid nineties, and started working on the server-side languages a few years later After writing CGI in C and Perl, Kae switched to PHP in 2000, and has worked with it since then Kae is currently the secretary of the Irish PHP Users' Group, http://php.ie/, is part-owner of the Irish web-development company Webworks.ie, http://webworks.ie/, and is the author of popular web-based file-manager KFM, http://kfm.verens.com/ In his spare time, Kae plays the guitar, juggles, is learning to play the piano, and likes to occasionally dust the skateboard off and mess around on it I would like to thank Packt Publishing for considering me for this project; it's been a journey, and I've learned quite a lot from it I would also like to thank Webworks.ie for hiring me way back in 2001, when I was a brash programmer, eager to show how things should be done And finally, I'd like to thank Bronwyn and the kids for putting up with the days and hours that I've had to avoid them to concentrate on the book! www.it-ebooks.info About the Reviewers 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 print and online publications He is a regular speaker at IT conferences, user groups, and BarCamps Currently, Akash provides various services like web development, technical writing, consulting, and training through his website, http://bitmeta.org/ Hailing from an igloo somewhere up in Canada, Ashok Modi is currently a systems analyst for California Institute of the Arts (http://calarts.edu/) He was a systems (and games) programmer for zinc Roe Design (http://www.zincroe.com/), and has been working with Drupal for the last three years Starting from Drupal 4.6, he is the author of the abuse module (and looking for co-maintainers!), and has helped many maintainers in updating their contributed modules from 4.7.x to 5.x to 6.x He also helped organize DrupalCamp Toronto in 2007 and 2008 and recently presented multiple sessions at DrupalCamp LA in 2009 In his spare time, Ashok tries to help contributed module maintainers with features and bugs He was a technical reviewer on another book, Drupal Social Networking, also published by Packt Publishing I would like to thank my wife, Richa, for letting me obsess over technology and pushing me to freelance and try other open-source technologies in my spare time John K Murphy is a graduate of the University of West Virginia and has been wrapped up in computers and software development since the 1980s When he is not buried in a book or jumping out of an airplane, he works as an IT consultant John lives with his wife and two children in Pittsburgh, PA and is currently obsessing about the Internet of Things www.it-ebooks.info www.it-ebooks.info 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 10 12 13 14 16 16 16 17 18 18 19 21 22 How it works 23 Server-side code Quick deletes Client-side code Server-side code Contextual help Inline editing Client-side code Server-side code Summary 25 26 27 30 31 36 36 41 41 www.it-ebooks.info Table of Contents 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 43 44 45 49 49 50 53 54 55 56 57 Server-side management of tabs Server-side code 58 58 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 61 63 63 66 67 69 69 69 71 Just the conversion Now show the data with the tabs 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 [ ii ] www.it-ebooks.info 59 60 73 74 74 77 77 78 79 81 81 82 83 84 85 86 Table of Contents Auto-suggestion Client-side code Server-side code Client-side code Summary 87 88 89 90 91 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 93 93 95 95 97 100 100 104 105 105 108 109 109 112 113 114 115 116 116 117 118 119 120 121 122 124 126 126 127 128 128 129 [ iii ] www.it-ebooks.info Chapter 10 Now, when the it link is clicked, you can see things progressing smoothly, and if you want to click on buttons or go to different tabs or perform any other browser action, you can so The 10 millisecond delay allows the browser enough time to refresh any changed content, or respond to user events The var i=start || 0; statement is an alternative to the var i=start?start:0; statement However, it's very mildly faster Use var for your variables Here is an example of JavaScript that does not use the var keyword: function test(){ for(i=0;i

Ngày đăng: 06/03/2019, 17:00

w