Uploader: Ollie
Country: Greece
Uploaded: May 03, 2018
Price: Free

Please, verify you are not robot to load rest of pages

download yii book larry ullman pdf

The Yii Book by Larry Ullman
Self-published
Find this book on the Web at yii.larryullman.com.
Revision: 0.9
Copyright © 2014 by Larry Ullman
Technical Reviewer: Qiang Xue
Technical Reviewer: Alexander Makarov
Cover design very kindly provided by Paul Wilcox.
Notice of Rights
All rights reserved. No part of this book may be reproduced or transmitted in any
form by any means, electronic, mechanical, photocopying, recording, or otherwise,
without the prior written permission of the author.
Notice of Liability
The information in this book is distributed on an “As Is” basis, without warranty.
While every precaution has been taken in the preparation of the book, the author
shall not 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 instructions contained
in this book or by the computer software and hardware products described in it.
Trademarks
MySQL is a registered trademark of Oracle in the United States and in other countries. Macintosh and Mac OS X are registered trademarks of Apple, Inc. Microsoft
and Windows are registered trademarks of Microsoft Corp. Other product names
used in this book may be trademarks of their own respective owners. Images of Web
sites in this book are copyrighted by the original holders and are used with their
kind permission. This book is not officially endorsed by nor affiliated with any of
the above companies.
Many of the designations used by manufacturers and sellers to distinguish their
products are claimed as trademarks. Where those designations appear in this book,
and the author was aware of a trademark claim, the designations appear as requested
by the owner of the trademark. All other product names and services identified
throughout this book are used in editorial fashion only and for the benefit of such
companies with no intention of infringement of the trademark. No such use, or the
use of any trade name, is intended to convey endorsement or other affiliation with
this book.
ISBN-13:
ISBN-10:
ii
This book is dedicated to:
Qiang Xue, creator of the Yii framework; Alexander Makarov,
and the whole Yii development team; and to the entire Yii
community. Thanks to you all for making, embracing, and
supporting such an excellent Web development tool.
iii
Contents
Introduction
1
Why Frameworks? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
Why Yii? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
What You’ll Need . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
About This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
1 FUNDAMENTAL CONCEPTS
13
Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . .
13
The MVC Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
Using a Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
Command Line Tools
26
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 STARTING A NEW APPLICATION
31
Downloading Yii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
Testing the Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
Installing the Framework . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
Building the Site Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
Testing the Site Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
3 A MANUAL FOR YOUR YII SITE
The Site’s Folders
37
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
Referencing Files and Directories . . . . . . . . . . . . . . . . . . . . . . .
39
Yii Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
How Yii Handles a Page Request . . . . . . . . . . . . . . . . . . . . . . .
41
i
CONTENTS
4 INITIAL CUSTOMIZATIONS AND CODE GENERATIONS
46
Enabling Debug Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
46
Moving the Protected Folder . . . . . . . . . . . . . . . . . . . . . . . . .
47
Basic Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48
Developing Your Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .