Doctrine with zf3 cache

Martin Zeller doctrine, php, zf3 Leave a Comment

That’s the way how to use Zend Cache with Doctrine in Zend Framework 3. First do all doctrine settings and define a cache in your global.php:

  Then define a service ‘doctrine.cache.zend.dbcache‘ in your module/Application/src/Module.php:

zf2 – translatePlural example with Poedit

Martin Zeller php, zf2 1 Comment

I’d like to explain how to use the translatePlural method along with the Zend Framework 2. (I’m assuming that you have been configured Poedit and the Zend Framework so that it works with the normal translate method) The use of translatePlural is actually quite simple. Let us first look at the normal translate method: After parsing your code files with …

Subdomain based mobile versions in zf2 projects

Martin Zeller php, zf2 Leave a Comment

A few weeks ago it was my job to extend an existing Zend Framework 2 project with a mobile version. The orderer wanted when calling a for mobile clients optimized version of should be delivered. Some mobile versions of pages should have only a changed layout, while others should provide additional content. These requirements (for requests with the …

zf2 – logger problems with the FirePhp/FireBug writer in a console request

Martin Zeller php, zf2 Leave a Comment

In my  recent zf2 (zend framework 2.1) project module I defined a logger with a stream writer and a firephp writer. I am using the same module also for some console requests (Zend\Console). The problem I had was that the system complains of the firephp logger when I did a console request: Short: Cannot send log data to FirePHP.  So …

zf2, doctrine module and expressions (like ‘IS NOT NULL’)

Martin Zeller doctrine, php, zf2 Leave a Comment

Currently I am working on a migration of a zend framework 1 project to zf2 (zend framework 2). Furthermore I want to introduce Doctrine to the project. There are some useful articles about installing and using the zf2 doctrine module. After some hours I found out how to use modules and Doctrine in zf2. Sometimes you will have code like …

Zend_Captcha, an example without Zend_Form

Martin Zeller php 2 Comments

Here is your example how to implement Zend_Captcha_Image without using Zend_Form. In your action method: In the corresponding view render the captcha and add a hidden field with the captcha id: Validating the input of the user after postback: Good luck! PS: If you want to use your Zend_Captcha WITH Zend_Form, this blog post may help you: Zend_Captcha with Zend_Form

Client localisation with zend framework

Martin Zeller php Leave a Comment

If you want to find out the language or country of the clients browser, do it this way: But be aware! This way you only get the localisation of the clients browser. And this is configurable by the user. The code above will give you output like this: or There are many methods you can use with zend localisation: Example …