Prev | Current Page 79 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

manning-sandbox.com/forum.jspa?forumID=329
For Places, we are going to use PHP??™s __autoload() functionality so that PHP will automatically load our
classes for us. PHP5 introduced the __autoload() magic function that is called whenever you try to instantiate a
class that hasn??™t yet been defined. The Zend_Loader class has a special function registerAutoload() specifically
for use with __autoload(). This method will automatically use PHP5??™s Standard PHP Library (SPL) function
spl_autoload_register() so that multiple autoloaders can be used. After Zend_Loader::registerAutoload() has
been called, whenever a class is created which has not yet been defined, file containing the class is included.
This solves the problem of Zend_Loader::loadClass() clutter nicely.
3.2.4 Configuration with Zend_Config
There is an implicit requirement that Places will store its data to a database, such as MySQL. We therefore
need to store the database connection settings and we will use Zend_Config for this purpose. Zend_Config
provides for three types of configuration file format: XML, INI and PHP Arrays. We will use the INI format as
it easy to maintain. Zend_Config provides an object oriented interface to the configuration data regardless of
which file format has been loaded.


Pages:
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
hosting zakłady bukmacherskie zrębki motoryzacja wydawnictwa