Zend Framework Tutorial: Version 1.1
It turns out that there are hardly any changes required to make the tutorial code compatible with version 0.2 of the Zend Framework! The only changes I had to make were to the index.php file.
The two changes needed were:
- Zend_Config construction
- You now create a Zend_Config_Ini directly:
$config = new Zend_Config_Ini('./application/config.ini', 'general');is all that’s needed now!
- Front Controller instantiation
- For the original tutorial, I needed a special route for compatibility. This is now included by default in 0.2, so the work needed to be done is less. However, I’ve been playing with setting the rewrite base, and may have a better solution now. The new code for this bit is now:
$router = new Zend_Controller_RewriteRouter();
$baseUrl = substr($_SERVER['PHP_SELF'], 0,
$controller = Zend_Controller_Front::getInstance();
I think it’s more likely to work on more configurations than my previous code. If anyone can see a security hole in this particular use of PHP_SELF, please shout though!
The new tutorial (version 1.1.0 – this time I’m prepared for point releases!) is available in the usual place. As always, comments and bug fixes are very welcome!