Category: Zend Framework

Display localized dates in Magento

Since Magento uses the Zend Framework you are able to use Zend_Date to easily display localized dates in Magento. So, first create a Zend_Date object based on the locale set in the administration backend: Then simply output your date as localized string using Zend_Date->toString: Us usual, find formating rules in the Zend_Date constants documentation.

Managing Doctrine 2 Entity Model mapping classes using YamlDriver in Zend Framework 2

This post continues my approach to integrate Doctrine 2 into Zend Framework 2 by additionally setting up YamlDriver to generate and manage Doctrine 2 Entity model mapping files. First, we need to install the YAML dependency symfony/yaml: And rebuild our project: In case you forget the install the symfony/yaml module you will get an error […]

Zend Framework 2 and Doctrine 2 ORM Integration

So, finally I’ve found time to start a new approach of migrating older Zend Framework (ZF) 1 projects to ZF2. To get most out of ZF2 and its new modular design I’ve decided to simultaneously try out the Doctrine 2 ORM module. These are the steps I’ve used to integrate Doctrine 2 into ZF2. Skeleton […]

Web-based KeePass(X) Management Tool

KeePass and KeePassX are almost perfect tools when it comes to storing passwords and other sensitive information. Almost, since these tools currently only work offline and do not expose command line options out of the box. Since I want to access certain information on the road I was searching for ways to access KeePass and […]

Updating Select Options and InArray Validator in Zend Form

When using Zend_Form’s multi-select with dynamically set options you need to make sure to update your options and the InArray validator accordingly when validating data using form->isValid(). In order to update selection options and update the InArray validator we need to first set the options, remove the currently set InArray validator and set it with […]

Web Interface for SMS Server Tools 3

I have been using SMS Server Tools 3 (smsd) for numerous projects in the past due to its stability and configurability. Since smsd does not provide a graphical UI out-of-the-box I have decided to develop a web interface for users to be able to manage their SMS data, much like an e-mail application, called SMS […]

Custom Zend_Form view script

Sometimes Zend’s built-in form decorators are not flexible enough to achieve customized views. Luckily, Zend provides means to specify custom view scripts. The following example demonstrates how to set and handle such a script. First and foremost, in your default (action) view script simply output the form as usual: Then, in your derived Zend_Form class […]

Control Zend’s layout rendering and Content-Type specifications

In case you need to return content types other than the one set by server (Apache, etc.) or Zend itself use the following lines to quickly control Zend’s layout rendering and Content-Type specification. This is crucial for instance if your controller is required to return JSON or XML as part of a service request.

File Uploads using Zend_Form

File uploads can be managed quite easily using Zend_Form. First off, create a Zend_Form instance and add a Zend_Form_Element_File element, representing the file-input element. Make sure to set the encoding type to multipart/form-data: Now that we have a form let’s add the logic in the corresponding controller. We only need one action (imageAction) to process […]

Custom Zend Validator for Localized Numbers

When dealing with i18n web applications the need to support localized number representations becomes obvious. Thus, users should be able to enter localized numbers such as “1.000.50 $” when for instance using the locale en_US or “1,000.50 $” when using de_AT. Now, when it comes to validating user input throughZend_Form Zend provides special validators to […]

Mehrseitige Formulare mittels Zend Framework umsetzenImplementing multi-page forms using the Zend Framework

Unfortunately, the Zend Framework (ZF) version 1.x currently does not provide a standard way or class to implement multi-page forms based on Zend_Form. Due to the fact that this is a very common use case I will try to explain a working solution to overcome this problem. Basically, the goal is to provide means to […]

Liste der von Google Currency Converter unterstützten Währungen (ISO-4217 Codes)List of currencies supported by Google currency converter (ISO-4217 codes)

The following is a list of ISO-4217 currency codes supported by Google’s currency converter available at http://www.google.com/ig/calculator. After some research this list includes all of the most commonly used currencies world-wide (please leave a comment if you find any errors or missing entries). Thus. it can be used as a template for currency selection drop-downs, […]