Tag Archives: PHP

Zend Framework 1 Extension Library and Composer

Maybe I am a bit late to get on the Composer bandwagon, but a colleague was adamant about it and convinced me to use Composer in our projects. The benefit of using Composer with your PHP applications is that it will download any library dependencies for you, and take care of the autoloading of classes. So I enabled Composer in my Zend Framework 1 Extension library, with a Zend Framework 1.* dependency. Read on how to get the libraries using Composer!

Continue reading Zend Framework 1 Extension Library and Composer

Enumerations in PHP

In the C programming language, enumerations are handy little data types, which add more linguistic context to the code. They make code more readable, and enforce variables to have certain values. The latter is certainly true, if you have ever assigned string-valued codes to your variables and made a typo somewhere. For example assigning 'white' to the variable $color, and then make a typo somewhere in the code by using 'whiet' or something like that. The program would still compile or run, and not complain at all, while there is something fundamentally wrong with the code.
Continue reading Enumerations in PHP

Multi-lingual views in Zend Framework 1

Ever felt like this?

Build us a multilingual website

If so, do read on. Because it has become easier.

Do you want to quickly organize your multi-language website in Zend Framework, such that you can easily add languages without breaking the website? And from there, progressively translate pieces of your website? Imagine a website where you have a handful of static content – think of about pages, policy pages and disclaimer pages – and you want to easily add translated pages to your system, without having to go through programming the logic of selecting the right view for these pages.

Look no further, for the ZF1E library offers exactly that solution. Using the built-in MultiLanguage resource, it will determine which language part of your website your visitor is accessing, and grab the correct view for that language.

Continue reading Multi-lingual views in Zend Framework 1

Cookies and Internet Explorer

Cookies for everybodyImagine you have a Zend Framework (version 1) application on a domain example.org, and another on a domain admin.example.org. They both have authentication mechanisms using Zend_Auth. This authentication information is stored in a browser cookie. Now I came across this problem that being logged in on both systems does not pose any problems with Google Chrome or Mozilla Firefox, but for some very strange reason, Microsoft Internet Explorer didn’t like it. The admin.example.org domain would be broken if you were logged in on example.org first. The server spewed out a 500 Internal Error, so I checked in the server logs to see what the heck was happening.
Continue reading Cookies and Internet Explorer

Multi-lingual resource in Zend Framework 1

To continue my previous post, but this time tie it to the Zend Framework (version 1), I have added a ZF application resource plugin to my library which redirects the visitor to the correct language sub-domain according to his browser’s settings. This plugin will take care of the redirection logic, and keep all the necessary information for the application to provide the user with the GUI elements for switching languages.

Continue reading Multi-lingual resource in Zend Framework 1