yii 1.1 application development cookbook

392 595 4
yii 1.1 application development cookbook

Đ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

[...]... define( 'YII_ DEBUG', false); defined( 'YII_ TRACE_LEVEL') or define( 'YII_ TRACE_LEVEL', 0); $yii= dirname( FILE ).'/ /framework /yii. php'; $config=dirname( FILE ).'/ /app/config/production.php'; require( $yii) ; Yii: :createWebApplication($config)->run(); 3 Preface When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold: defined( 'YII_ DEBUG') or define( 'YII_ DEBUG',... when it finishes ff Yii' s application component has two events that will come in handy in this case: CApplication::onBeginRequest and CApplication::onEndRequest Let's use them Put the following in index.php after configuring an application but before running it: … require_once( $yii) ; $app = Yii: :createWebApplication($config); 12 Chapter 1 // attaching a handler to application start Yii: :app()->onBeginRequest... block, the relevant lines or items are set in bold: defined( 'YII_ DEBUG') or define( 'YII_ DEBUG', false); defined( 'YII_ TRACE_LEVEL') or define( 'YII_ TRACE_LEVEL', 0); $yii= dirname( FILE ).'/ /framework /yii. php'; $config=dirname( FILE ).'/ /app/config/production.php'; require( $yii) ; Yii: :createWebApplication($config)->run(); Any command-line input or output is written as follows: cd path/to/protected/tests... mode iv 341 341 344 346 348 354 357 360 Preface Yii is a very flexible and high-performance application development framework written in PHP It helps building web applications from small ones to large-scale enterprise applications The framework name stands for Yes It Is This is often the accurate and most concise response to inquires from those new to Yii: Is it fast? Is it secure? Is it professional?... Introduction Using Zend Framework from Yii Customizing the Yii autoloader Using Kohana inside Yii Using PEAR inside Yii 209 209 216 220 223 227 229 233 235 241 246 249 250 256 259 263 269 269 274 278 284 287 295 295 300 304 311 321 321 326 331 339 iii Table of Contents Chapter 13: Deployment 341 Index 363 Introduction Changing the Yii directories layout Moving an application out of webroot Sharing the... cover the most interesting Yii features that are hidden "under the hood" These are mostly described in the framework API, but since they are not mentioned in the official guide (http://www.yiiframework.com/doc/guide/) or mentioned very briefly, only experienced Yii developers usually use these Yet, features described here are relatively simple and using them makes development with Yii much more fun and... http://www.php.net/manual/en/language.oop5.overloading.php#language oop5.overloading.members See also ff The recipe named Using Yii events in this chapter ff The recipe named Configuring components in this chapter Using Yii events Most Yii classes are extended from CComponent which allows us to achieve great application flexibility by using events An event is a message indicating that the application did something We can register several event handlers that... recommended ff Yii: ‰‰ latest 1.1. x Additionally, the following tools are not strictly required but are used for specific recipes: ff PHPUnit ff XDebug ff Selenium RC ff PEAR ff Smarty ff memcached Who this book is for If you are a developer with a good knowledge of PHP5, are familiar with the basics of Yii, have checked its definitive guide, and have tried to develop applications using Yii, then this... handler to application end Yii: :app()->onEndRequest = function($event) { // releasing output buffer return ob_end_flush(); }; $app->run(); There are many handy events defined inside Yii core classes You can get them all by searching for "function on" text in the framework folder using your favorite IDE Now, let's look at another example In Yii, you can translate strings to different languages using Yii: :t... works The built-in Yii class loader requires that each class should be placed into a separate file named the same as the class itself How it works Let's look at application. apis.lyrics.LyricsFinder: application is a standard alias that points to your application protected folder and is translated into a filesystem path The following table shows some more standard aliases: Alias Path application system . alt="" Yii 1. 1 Application Development Cookbook Over 80 recipes to help you master using the Yii PHP framework Alexander Makarov BIRMINGHAM - MUMBAI Yii 1. 1 Application Development Cookbook Copyright. 10 3 Introduction 10 3 Writing your own validators 10 3 Uploading les 10 6 Adding CAPTCHA 11 0 Customizing CAPTCHA 11 5 Creating a custom input widget with CInputWidget 11 7 Chapter 5: Testing your Application 12 1 Introduction. 304 Proling an application with Yii 311 Chapter 12 : Using External Code 3 21 Introduction 3 21 Using Zend Framework from Yii 3 21 Customizing the Yii autoloader 326 Using Kohana inside Yii 3 31 Using PEAR

Ngày đăng: 30/06/2014, 21:14

Từ khóa liên quan

Mục lục

  • Cover

  • Copyright

  • Credits

  • Foreword

  • About the Author

  • About the Reviewers

  • www.PacktPub.com

  • Table of Contents

  • Preface

  • Chapter 1: Under the Hood

    • Introduction

    • Using getters and setters

    • Using Yii events

    • Using import and autoloading

    • Using exceptions

    • Configuring components

    • Configuring widget defaults

    • Using Yii core collections

    • Working with request

    • Chapter 2: Router, Controller, and Views

      • Introduction

      • Configuring URL rules

Tài liệu cùng người dùng

Tài liệu liên quan