October 20, 2009, 22:16
Recently, I have been using view script partials (Zend_View_Helper_Partial) and wanted to assign an object as an object to a partial and have full use of it in the partial. I found the solution in the ZF manual very impractical and thought of another way to solve this. In this post I describe the ‘ZF manual’ way to do it, and my easier way.
Continue reading ‘ZF: assigning objects to partials the easy way’ »
July 22, 2009, 23:59
Just a short one this time. This is something I encountered at work today.
I started a new ZF project in our development environment, which makes use of dynamic virtualhosts.
When I started the application for the first time in the browser, I got an internal server error.
Of course I didn’t expect this. So I had a look at the apache logs and found entries like this:
[Wed Jul 22 16:00:26 2009] [debug] core.c(3052): [client 192.168.0.7] redirected from r->uri = /data/virtualhosts/dev/...
After some googling, I found out this has something to do with having apache rewrite rules in combination with dynamic virtualhosts. Then I had a look at an older ZF project on the same server and found a small but significant difference:
Standard .htaccess created by Zend_Tool:
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
And here is the last line of the older .htaccess, the rest is identical:
RewriteRule ^.*$ /index.php [NC,L]
Notice the difference? There is a forward slash before index.php in the working .htaccess.
I simply added the forward slash in the non-working htaccess, and everything worked fine!
Note: this may not work for you, as I have seen articles where REMOVING the forward slash was the solution. It is entirely dependent on your specific apache config and more importantly, your apache version. This is because there have been changes in how apache matches redirects in recent releases.
July 9, 2009, 01:01
Separate modules should be able to have separate Zend_Translate sources. As can be read in my earlier post about module configuration, I am making my modules completely autonomous in their config. That also means they should have their own translation sources that are automatically added to the main Zend_Translate instance for easy reference. In this article I will show you how to set this up.
Continue reading ‘Zend Framework: per module translation sources’ »
July 7, 2009, 00:11
Zend Framework supports modules, but in my opinion, not in a modular way. I have been trying to set up self-containing modules with their own configuration. The objective is to have an architecture where I can just drop a module in the modules directory, and it will work immediately without further configuration.
Now that there is Zend Application with the Modules Resource, that is almost possible. There is one problem. The module specific config still has to be put in application.ini. On the Zend Framework mailinglists, many people are clamoring for module specific configuration files. In this article I will explain how to set up modules with their own config files.
Continue reading ‘Zend Framework: module config’ »
April 6, 2009, 20:59
Welcome to my website. On this site I will be posting about all things that have to do with web development with some emphasis on Zend Framework. My aim is to provide a place where developers will find many useful tips and snippets to use in their own projects. To do that, I will not only publish about my own insights and code, but also about great pieces of code by other developers.
Let’s get started right away: I have started finetuning a generic grid component for Zend Framework that I have been using for my own projects for a while now. In my experience it severely cuts development time of web applications; because as we all know, web applications are at their core nothing more than lists and CRUD. There is a limitation that many people will regret: it can’t do everything. I will post the first draft with documentation soon.