11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 24 • INTRODUCING THE ZEND FRAMEWORKwww.it-ebooks.infoConfiguring Zend_ToolIf this is your first time using Zend_Tool, you’ll need to take care of some preliminary configurationbusiness first. Once configured, you won’t need to carry out the steps described in this section again.Begin by returning to the Zend Framework download directory and locating the zf.bat, zf.sh, andzf.php files, all three of which are found in the bin directory. The zf.bat file is the Zend_Tool commandlineinterface used on Windows, while the zf.sh file is intended for Linux users. Move the zf.php andappropriate aforementioned file to a location within your operating system path, so that you can executethe zf command from anywhere within the operating system console. If you’re in Windows and don’tknow where to place these files, the same directory as your php.exe file would be ideal; in Linux, the/usr/bin directory would be suitable.Next, open up a console and execute the following commands to configure Zend_Tool:%>zf create config%>zf enable config.manifest Zend_Tool_Project_Provider_ManifestZend_Tool is now configured and capable of generating the Zend Framework project skeleton.Generate the Project SkeletonTo generate a new Zend Framework project using Zend_Tool, navigate to your web server’s htdocsdirectory and execute the following command:%>zf create project contactsCreating project at /var/www/contactsNote: This command created a web project, for more information setting up your VHOST,please see docs/READMEBelieve it or not, executing this simple command created the considerable amount of code anddirectories required to power a Zend Framework project. You can examine what has been generated bynavigating to the newly created contacts directory. Each generated directory and file plays an importantrole in the operation of a Zend Framework-powered website, so I’ll take a moment to briefly introduceeach one before moving on with the implementation of the contact application.applicationThe application directory contains the majority of the code used to power the application, including theconfiguration file, controllers, models, and views. There you’ll also find a file named Bootstrap.php,which, although initially empty, can be used to initialize application-specific resources such as customextensions (known as plugins in Zend Framework parlance).docsThe docs directory is used to house application documentation. Although not required, it would be fairlytrivial to use a documentation solution such as phpDocumentor (www.phpdoc.org) to document yourapplication classes and store the document files in this directory.libraryThe library directory is added to your application’s internal include path from the outset, meaning anythird-party libraries you place within it can be easily referenced within your application code. For464

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!