All posts tagged zend framework

Extracting Translatable Strings From Zend_Validate

Recently I started working with Zend Framework’s Zend_Form and its integrated automatic translation functionality using Zend_Translate. In general, the functionality is really great, but if you have ever tried to translate all of the possible validation error messages, you know that finding them can be a long manual task. Naturally, I brought this up on #zftalk, and the consensus seemed to be that the translatable messages could be extracted using a little PHP and ReflectionClass magic.

Continue reading →

Benchmarking Zend Framework Routes

Hanging out in #zftalk on freenode is a great way to learn more about using Zend Framework, if you’re not already there get yourself an IRC client and sign on. Recently, the following question was posed:

How can I create a route with an optional parameter; e.g /search/:foo/:bar, where :bar is optional? Do I need to create two different routes?

Several users correctly suggested specifying a default value for :bar when constructing the route, and it was also mentioned that both standard routes and regular expression routes could be used to solve the problem. Naturally, this lead to a discussion of which type of route would be fastest, with no real numbers to fall back on.

Continue reading →

Migrating to Zend Framework: Legacy Scripts

Migrating an existing PHP application to Zend Framework can be a daunting task, especially if the migration must occur all at once. It is much easier to migrate the application in sections over a longer period of time. This approach requires some modification from a normal Zend Framework setup Continue reading →

Using Module Templates with Zend Framework

I’ve just finished watching some of the archived webinars related to Zend Framework over at Zend.com, and found some great information about rendering view output into a sitewide template in the MVC applications with Zend Framework webinar.

Since I’m currently developing a website with multiple modules, each having their own distinct look, I’d like to extend the examples provided in the webinar to allow specifying per-module templates. Here is what I came up with:

Continue reading →