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!
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
Ever felt like this?
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.
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.
When you make a new website or work on a new project, you want to keep it as easy as possible to add new pages. Zend Framework 1 offers a few ways to do this, for example if all the actions in your controller share some common code, you would put that in the controller’s
init() function. But what if your whole site shares some common code?