Databases Reference
In-Depth Information
b. Next, we need to set the rule to redirect all incoming Web requests to
www/index.php. You can easily do this by creating a .htaccess file in the
www directory with the contents as shown in Example 3-2.
Example 3-2 .htaccess file
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
The above file redirects all requests not containing one of the previous file
extensions to index.php bootstrap file.
Alternatively, you can modify httpd.conf also for the rewrite rules, but that
requires you to restart the Web server. Adding to .htaccess file does not
require you to restart Web server.
Note: This is the only php file required to exist within the Web server
document root directory. Also for security reasons, it makes sense not
to store the php files in the directories that are accessible by the Web
server.
You also need to include the include_path to the framework library
directory (zframework/lib). You can add this to the php.ini file or simply add
it into .htaccess as shown in Example 3-3.
Example 3-3 include_path
php_value include_path "C:\Program Files\Apache
Group\Apache2\htdocs\zframework\lib"
Zend class
The Zend class (zend.php) contains static methods that are used by many
classes. This is the only class you need to include manually, so we add it to
our bootstrap file index.php.
After adding it to the bootstrap file, we now have access to all static methods.
You can load other classes with the loadClass() method. For example, to load
Zend_Controller_Front:
Zend::loadClass('Zend_Controller_Front');
Search WWH ::




Custom Search