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

Apress beginning CakePHP from novice to professional jul 2008 ISBN 1430209771 pdf

341 42 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 341
Dung lượng 3,78 MB

Nội dung

 CYAN  MAGENTA  YELLOW   BLACK  PANTONE 123 C Books for professionals by professionals ® The EXPERT’s VOIce ® in Web Development Companion eBook Available From Novice to Professional Dear Reader, Rapid development frameworks surfaced not long ago, finally bringing to the web development world the effective tools other software systems have enjoyed for a long time If you are like me, you can probably recall poring over all the online documentation you could find trying to learn these new methods for building web sites, only to find they all required that you learn another programming language with which you hadn’t previously worked Or you probably found several dead ends where the tutorials or terminology confused you As web frameworks became increasingly popular, what I wanted was a framework in PHP, the language I had already learned and loved, that could deliver all that I was reading about in these other platforms And I wanted someone to tell me in simple terms how and where to start I found CakePHP— the most robust, cleanest, well-designed PHP framework available—and now building web sites has never been better This book provides you with a good start to CakePHP You will learn where to begin, what tools Cake provides, and how to rapidly write methods into your application Cake comes with an impressive collection of helper functions and core methods that make data handling, form processing, Ajax request handling, file uploading, XML parsing, and other web-related tasks much easier to manage I explain each of these and other tasks and how to use Cake to accomplish them My aim is to make learning this fantastic framework easy and exciting and to provide you with a simple approach that gets you started on the right path to creating web sites with CakePHP David Golding Beginning CakePHP Beginning CakePHP: Beginning CakePHP From Novice to Professional Learn where to begin, what tools Cake provides, and how to rapidly write methods into your Web applications Companion eBook THE APRESS ROADMAP See last page for details on $10 eBook version Beginning PHP and MySQL, Third Edition Beginning CakePHP Practical CakePHP Projects www.apress.com ISBN 978-1-4302-0977-5 54299 US $42.99 Golding SOURCE CODE ONLINE David Golding Shelve in Programming/PHP User level: Beginner–Intermediate 781430 209775 this print for content only—size & color not accurate spine = 0.802" 344 page count 09775fmfinal.qxd 7/1/08 9:55 PM Page i Beginning CakePHP From Novice to Professional David Golding 09775fmfinal.qxd 7/1/08 9:55 PM Page ii Beginning CakePHP: From Novice to Professional Copyright © 2008 by David Golding All rights reserved No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher ISBN-13 (pbk): 978-1-4302-0977-5 ISBN-13 (electronic): 978-1-4302-0978-2 Printed and bound in the United States of America Trademarked names may appear in this book Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark Lead Editors: Steve Anglin, Tom Welsh Technical Reviewer: Richard K Miller Editorial Board: Clay Andres, Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Sofia Marchant Copy Editor: Kim Wimpsett Associate Production Director: Kari Brooks-Copony Production Editor: Laura Cheu Compositor: Linda Weidemann, Wolf Creek Press Proofreader: Nancy Sixsmith, ConText Editorial Services, Inc Indexer: Becky Hornyak Artist: Kinetic Publishing Services, LLC Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013 Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705 Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use eBook versions and licenses are also available for most titles For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales The information in this book is distributed on an “as is” basis, without warranty Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work The source code for this book is available to readers at http://www.apress.com You will need to answer questions pertaining to this book in order to successfully download the code 09775fmfinal.qxd 7/1/08 9:55 PM Page iii To Camille and Kenny— your sacrifices, above all, make this all possible 09775fmfinal.qxd 7/1/08 9:55 PM Page iv Contents at a Glance About the Author xvii About the Technical Reviewer xviii Acknowledgments xix ■CHAPTER PART ■■■ Getting Started ■CHAPTER ■CHAPTER Installing and Running CakePHP Creating a To-Do List Application 17 PART Developing CakePHP Applications ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER PART ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER ■CHAPTER iv Introduction ■■■ Naming Files and Designing the Database 29 Creating Simple Views and Baking in the Console 55 Customizing Views 73 Working with Controllers and Models 89 Implementing Ajax Features 113 ■■■ 10 11 12 13 14 15 Advanced CakePHP Helpers 137 Routes 175 Components and Utilities 187 Vendors 207 Plugins 219 DataSources and Behaviors 241 Wrapping Up the Application 273 09775fmfinal.qxd 7/1/08 PART 9:55 PM ■■■ ■APPENDIX A ■APPENDIX B Page v Appendixes Installation Issues 281 How CakePHP Compares with Other Frameworks 289 ■INDEX 295 v 09775fmfinal.qxd 7/1/08 9:55 PM Page vi 09775fmfinal.qxd 7/1/08 9:55 PM Page vii Contents About the Author xvii About the Technical Reviewer xviii Acknowledgments xix ■CHAPTER Introduction From Novice to Professional Why Cake? It’s PHP! Rapid Development Model-View-Controller CRUD Operations and the Bake Script Scaffolding Helpers Customizable Elements Large Community More Features Summary PART ■■■ ■CHAPTER Getting Started Installing and Running CakePHP A Simple Start: Running Cake on a Localhost Environment Getting Cake 10 Launching Cake 10 Running the Setup Routines 13 Preparing the tmp Folder for Cake to Read and Write Temp Files 13 Changing the Security.salt Value 13 Entering MySQL Connection Settings 14 Designing Your Database Schema 15 Summary 16 vii 09775fmfinal.qxd viii 7/1/08 9:55 PM Page viii ■CONTENTS ■CHAPTER Creating a To-Do List Application 17 Exploring the MVC Structure 17 The To-Do List’s MVC Layout 19 Designing and Creating the Database 19 Creating Models 20 What’s Happening in This Model 21 Model Possibilities 21 Creating Controllers 21 What’s Happening in This Controller 22 Controller Possibilities 22 Launching the Application 22 How Cake Resolves URLs 23 Creating the Scaffolding 23 Summary 25 PART ■■■ ■CHAPTER Developing CakePHP Applications Naming Files and Designing the Database 29 Convention Over Configuration 29 Intercepting Cake 29 Starting with the Database 30 MVC Default Behaviors 30 Naming Conventions 31 Naming Controllers 31 Naming Models 32 Naming Views 33 More Than One Word in the Name 33 Naming Other Cake Resources 34 Best Practices 37 Poorly Designed Databases 39 Why Good Database Design Matters 39 Feature Creep and Cake 40 ... 7/1/08 9:55 PM Page i Beginning CakePHP From Novice to Professional David Golding 09775fmfinal.qxd 7/1/08 9:55 PM Page ii Beginning CakePHP: From Novice to Professional Copyright © 2008 by David Golding... available to readers at http://www .apress. com You will need to answer questions pertaining to this book in order to successfully download the code 09775fmfinal.qxd 7/1/08 9:55 PM Page iii To Camille... development 09775ch01final 7/1/08 9:37 PM Page CHAPTER ■ INTRODUCTION From Novice to Professional This guide is for beginners to CakePHP Whether or not you have much experience with the PHP scripting

Ngày đăng: 20/03/2019, 15:18