Category: PHP

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 […]

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 […]

How to access loop counters in Smarty

Sometimes Smarty’s syntax is not quite self-explanatory. Recently I was asked how loop counters can be implemented for foreach-loops. According to the API docs there’s an @iteration directive for this case, such that the following should work: Unfortunately, the value remained 0 regardless of the current loop iteration. Another (working) approach is to specify a […]

Multilanguage support in Silverstripe

Operating interational websites and portals naturally requires multilanguage support and localization. Especially more prominent frameworks provide i18n support right out of the box. One of these is Silverstripe which recently has been released in version 3. This brief article describes the steps required to activate multilanguage support in Silverstripe. First of all, you need to […]

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.

Post to Facebook Fanpage as Page Admin through App via Impersonation

There seems to exist a lot of confusion when it comes to (programmatically) posting to Facebook (FB) fanpages through the PHP SDK, especially when trying to post as one of the page’s admin through an app via impersonation. Thus, instead of posting through your regular FB user account you want to directly post to a […]