Pro Zend Framework Techniques -  Forrest Lyman

Pro Zend Framework Techniques (eBook)

Build a Full CMS Project
eBook Download: PDF
2010 | 1st ed.
500 Seiten
Apress (Verlag)
978-1-4302-1880-7 (ISBN)
Systemvoraussetzungen
39,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

The Zend Framework is a truly amazing PHP-based web application development framework and platform that is breathing new life into PHP development. One of the most common uses for a framework such as this is to build content-driven web sites.

Pro Zend Framework Techniques offers:

  • A structured guide for PHP developers, ultimately helping you to create more flexible software much more quickly
  • Clear guidance through the entire process of building a custom content management system (CMS) with the Zend Framework
  • The ideal example project, building a CMS, to illustrate how to use the many different aspects of the framework


Forrest Lyman is a passionate PHP developer who concentrates on content management systems (CMS) development. He developed the Digitalus CMS on the Zend Framework, progressing from version 0.1 through 1.5. Once Zend Framework reached its production release (1.0), Forrest released Digitalus as an open source project. Over the course of the project, he developed a wide range of sites based on the CMS, from small business sites to international non-profit and university systems. Working hands-on developing these sites with the Zend Framework has given Forrest a unique perspective into building extensible CMS systems with Zend Framework.
Zend Framework has been designed from the ground up to make PHP development as easy - and fun - as possible while promoting best practices and providing an extensible framework for complex applications. Content management systems are a particularly important class of applications - after all, serving content is what the web does best. As the project lead of the Digitalus CMS project, a commercial CMS built on Zend Framework, Forrest Lyman is particularly well-qualified to guide the reader through the involved process of building a full-fledged CMS. This book reflects the best practices that we have discovered with the help of the Zend Framework community over the last four years. Forrest brings our MVC components to life, while describing data persistence in detail using Zend_Db_Table and MySQL. Essential components for CMSs, such as Zend_Search_Lucene and Zend_Feed, are used to develop ZF modules to implement practical use cases. Finally, he covers advanced topics such as performance optimization and designing your CMS for extension. Those looking for a guide to using the latest components in Zend Framework will not be disappointed - Zend_Tool, Zend_Navigation, Zend_Application, and more are put to use in the extensive running example CMS application. This book is the perfect complement to the documentation that can be found on http://framework.zend.com. Wil Sinclair Project Lead, Zend Framework

Forrest Lyman is a passionate PHP developer who concentrates on content management systems (CMS) development. He developed the Digitalus CMS on the Zend Framework, progressing from version 0.1 through 1.5. Once Zend Framework reached its production release (1.0), Forrest released Digitalus as an open source project. Over the course of the project, he developed a wide range of sites based on the CMS, from small business sites to international non-profit and university systems. Working hands-on developing these sites with the Zend Framework has given Forrest a unique perspective into building extensible CMS systems with Zend Framework.

Dedication Page 4
Contents at a Glance 5
Table of Contents 6
Preface 15
About the Author 16
About the Technical Reviewers 17
Acknowledgments 18
Introduction 19
Who This Book Is For 19
Prerequisites 19
Chapter 1: Getting Started 20
Introducing Zend Framework MVC Implementation 20
The Controller: Zend_Controller_Front 21
The Model: Zend_Db 21
The View: Zend_View 22
Setting Up Your Development Environment 22
Installing Zend Server CE 22
Doing Rapid Application Development with the Zend Command- Line Tool 24
Creating Your Project 25
Building a Project with the Zend Tool Framework 25
Testing Your New Project 26
Exploring the Anatomy of Your Project 27
The public Folder 28
Redirecting the Request with .htaccess 28
The Index File 28
Additional Public Folders 29
The library Folder 29
The application Folder 29
Zend_Application 29
The Bootstrap Class 30
Application Configuration 30
Action Controllers 31
Views 31
Error Handling 32
Summary 35
Chapter 2: Designing Your Site 36
Rendering the Presentation Layer with Zend_View 36
View Scripts 36
View Helpers 36
Rendering the Presentation Layer with Zend_Layout 37
Using Zend_Layout on Its Own 37
Zend_Layout MVC 37
Three-Step Views 37
Designing the Interface 38
Organizing the Interface Components 38
Mocking It Up 40
Creating the Base HTML Page 41
Testing Your Design 44
Creating the Layout 45
Creating the Layout 45
Adding the Dynamic Head with Zend_View’s Placeholders 46
Adding the Dynamic Content to Your Layout 47
Rendering the Controller Response with Zend_Layout 47
Configuring Your Application to Use the Layout 48
Testing Your New Layout 48
Implementing the Skin 49
What Goes in a Skin? 49
Creating the Blues Skin 50
The skin.xml File 50
The Style Sheets 50
Building a View Helper to Render the Skin 52
Using the loadSkin Helper 53
Testing the Skin 54
Summary 55
Chapter 3: Building and Processing Web Forms with Zend_Form 56
The Anatomy of a Zend Framework Form 56
Rendering Forms 57
Processing a Form 57
Form Elements 57
Initial Elements 57
Zend_Form_Element_Button 57
Zend_Form_Element_Captcha 58
Zend_Form_Element_Checkbox 58
Zend_Form_Element_File 58
Zend_Form_Element_Hidden 58
Zend_Form_Element_Hash 58
Zend_Form_Element_Image 58
Zend_Form_Element_MultiCheckbox 58
Zend_Form_Element_Multiselect 58
Zend_Form_Element_Password 58
Zend_Form_Element_Radio 59
Zend_Form_Element_Reset 59
Zend_Form_Element_Select 59
Zend_Form_Element_Submit 59
Zend_Form_Element_Text 59
Zend_Form_Element_Textarea 59
Custom Form Elements 59
Creating a Page Form 59
Getting Started 60
Creating the Form 60
Adding Controls to the Form 61
The Author Text Control 62
The E-mail Text Control 62
The Date Text Control 63
The URL Text Control 63
The Description Text Area Control 63
The Priority Select Control 64
The Status Select Control 64
The Submit Button 65
Rendering the Form 65
Processing the Form 67
Styling the Form 68
Summary 71
Chapter 4: Managing Data with Zend Framework 72
Setting Up the Database 72
Creating the CMS Database 72
Configuring the Database Connection 72
Creating the bugs Table 73
Exploring the Zend Framework Models 74
Learning About the Models 75
Creating the Bug Model 76
Working with Bugs 76
Submitting a New Bug 76
Creating the createBug() Method 76
Updating the Bug Controller’s Submit Action 77
Viewing All the Current Bugs 78
Creating the fetchBugs() Method 78
Adding the List Action to the Bug Controller 79
Creating the List View 79
Filtering and Sorting the Bug Reports 81
Updating the fetchBugs() Method 82
Creating the Form to Filter and Sort the Bugs 82
Loading and Rendering the Filter Form 83
Processing the Filters and Sort Criteria 84
Limiting and Paginating Bug Reports Using Zend_Paginator 85
Updating the fetchBugs() Method to Return a Zend_Paginator Adapter 85
Refactoring the Bug Controller listAction() to Load the Paginator 86
Rendering the Bug Reports Using the Paginator 87
Updating a Bug 90
Updating the Bug Report Form 90
Creating the Edit Action 90
Creating the Edit View 91
Updating the Bug Record 91
Deleting a Bug 92
Adding the Delete Method to the Bug Model 93
Creating the Bug Controller Delete Action 93
Summary 94
Chapter 5: Working with CMS Data 95
Exploring the Data Structure 95
Traditional CMS Data Structures 95
Abstract Data Structures 95
Designing a Database That Can Grow with Your System 96
Implementing the Data Management System 97
Managing Content Nodes 98
Creating the content_nodes Table 98
Creating the ContentNode Model Class 98
Creating and Updating Content Nodes 99
Deleting Nodes 100
Managing Pages 100
Creating the pages Table 100
Creating the Page Model Class 100
Creating Pages 101
Updating Existing Pages 101
Deleting a Page 102
Defining and Working with Table Relationships 103
Defining the Relationships 103
The ContentNode to Page Relationship 103
The Page to Parent Page Relationship 103
Working with Related Items 104
Cascading Updates and Deletes 105
Working with Content Items 105
Using the Abstract CMS Content_Item Class 105
Creating the Base Class 105
Loading Pages 106
Using Utility Methods 108
Manipulating Data 109
Extending the Base Content Item Class 110
Summary 111
Chapter 6: Managing Content 112
Creating and Updating Content Pages 112
Creating the Page Content Item Class 112
Creating the Page Controller 114
Creating the Page Form 114
Rendering the Page Form 115
Inserting the New Page 117
Managing Pages 118
Editing an Existing Page 120
Opening a Page to Edit 120
Updating the Page 121
Deleting Pages 122
Rendering Pages 122
The Home Page 122
Rendering the Most Recent Pages 123
Setting This Page As Your Site’s Home Page 127
Opening a Page 127
Summary 129
Chapter 7: Creating the Site Navigation 130
How CMSs Manage Menus 130
Managing Menu Data 130
Creating the Menu Controllers 132
Creating a New Menu 133
Creating the Menu Form 133
Rendering the Create Menu Form 134
Processing the Form 136
Listing Current Menus 137
Updating a Menu 140
Opening the Menu to Edit 141
Updating the Menu 141
Deleting Menus 143
Managing Menu Items 143
Listing the Menu Items 144
Adding New Menu Items 146
The Menu Item Form 146
Creating the Add Menu Item Action 147
Rendering the Menu Item Form 148
Processing the Form 148
Sorting Menu Items 149
Updating Menu Items 152
Loading the Update Item Form 152
Rendering the Update Item Form 153
Processing the Update Item Form 153
Deleting Menu Items 154
Rendering Menus 155
Creating the Main Site Menus 156
Creating the Main Menus 156
Setting the Main Menu GUIDs 156
Rendering the Main Menus 157
Rendering the Admin Menu 158
Creating SEO-Friendly URLs 159
Summary 161
Chapter 8: Handling Security in a Zend Framework Project 162
Managing CMS Users 162
User Data and Model 163
Creating a New User 163
Creating the User Controller 163
Creating the User Form 164
Rendering the Create User Form 165
Processing the Form 166
Managing Existing Users 168
Updating Users 171
Deleting Users 174
Authenticating Users with Zend_Auth 175
Creating the User Landing Page 176
Creating the User Login 176
Logging Users Out 178
Adding User Controls to the Main CMS Interface 179
Controlling Access with Zend_Acl 181
Using Zend_Acl 182
Securing Your CMS Project 182
Summary 186
Chapter 9: Searching and Sharing Content 187
Working with the Lucene Search Engine 187
Creating a Search Index 187
Documents and Fields 187
Implementing Site Search 188
Securing Site Search 188
Creating the Search Index 189
The Build Action 189
The Build Search View 190
Searching the Site 190
The Search Form 191
Adding the Search Form to the Site 191
Processing a Search Request 192
Rendering Search Results 192
Testing Site Search 193
Working with Zend Feed 193
Creating the What’s New Feed 194
Securing the Feeds 194
Building and Rendering the Feed 194
Adding the Feed to the Site 196
Web Services and Zend Framework 197
Working with Existing Services 197
Creating an API for your CMS with Zend REST 198
The Base Class 198
Securing the API 198
Searching Pages 199
Creating Pages 199
Updating Pages 200
Deleting Pages 201
Creating the API Server 201
Testing the API 202
Testing Searching 202
Testing Creating a Page 203
Updating the Page 203
Deleting the Page 204
Summary 204
Chapter 10: Extending Your CMS 205
Creating the Module 205
Configuring Your Application to Load Modules 206
Rendering the Contact Form 207
Processing the Contact Form 209
Sending Mail with Zend_Mail 210
Creating the Mail Template 210
Rendering and Sending the HTML Message 211
The Confirmation Message 212
Securing the Form with Captcha 213
Using SMTP Mail Transport 214
File Attachments 215
Uploading the File 215
Attaching the File to Your Message 217
Summary 218
Chapter 11: Advanced Topics 219
Performance Tuning 219
About Zend_Db_Profiler 219
Testing Your Application 219
Creating the Profiler View Script 220
Adding the Profiler Script to the Site 221
Optimizing the CMS_Content_Item_Page Class 222
Caching 224
Implementing Cache 224
Configuring the Cache 225
Creating the Cache Application Resource 225
Caching Menu Data 227
Updating the Cached Menus 229
Caching Content Items 231
Internationalization 232
Getting Started with Zend_Translate 232
Zend_Translate_Adapters 232
Integrating Zend_Translate with Your Project 232
Other Hidden Gems 234
Summary 234
Chapter 12: Installing and Managing a Site with Your CMS 236
Creating the Database 236
Installing the Application 238
Alternate Installations 239
Sharing One Common Library 239
Configuring Your CMS 239
Managing Users 239
Creating a User 240
Updating a User 241
Deleting a User 241
Managing Content 241
Creating a Page 242
Updating a Page 242
Deleting a Page 243
Navigating Between Pages 243
Adding a Menu Item 243
Sorting Menu Items 244
Updating Menu Items 245
Deleting Menu Items 245
The Next Steps 245
Index 246

Erscheint lt. Verlag 10.3.2010
Zusatzinfo 500 p.
Verlagsort Berkeley
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Theorie / Studium
Informatik Web / Internet Content Management Systeme
Schlagworte CMS • Framework • Navigation • PHP • Rest • Web Services • ZEND
ISBN-10 1-4302-1880-0 / 1430218800
ISBN-13 978-1-4302-1880-7 / 9781430218807
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 3,1 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich