All posts by stoimen

Zend Framework – quick tutorial (part 3) – front controller plugins

Why writing a front controller plugin?

Almost every application uses a database connection and acl module. Why doing this in the bootstrap and to mantain many lines of code there, instead of making it clear and mantainable. Of course you can have all these lines of code in your bootstrap, but you know for serious applications that recently will become an obstacle. That’s why Zend Framework allows you to use Front_Controller plugin.

First in you bootstrap add those lines of code

 * add a simple plugin to the controller
$front->registerPlugin(new Zend_Controller_Plugin_Init())
      ->registerPlugin(new Zend_Controller_Plugin_Acl());

These two classes (Zend_Controller_Plugin_Init and Zend_Controller_Plugin_Acl) should be placed in two different files with the same names in Controller/Plugins directory under Zend folder, and garantee you that both classes will be instanciated before starting the front controller. Continue reading Zend Framework – quick tutorial (part 3) – front controller plugins

The SWFObject method createSWF problem

The Problem

Although the SWFObject method – createSWF is working fine under IE sets the wmode not to be transparent but with the strange value of window, i.e. <PARAM name=”WMode” value=”Window” />

The Solution is …

to replace the createSWF method calls with other SWFObject method – embedSWF. There you can simply describe the desired wmode for the flash.

Zend_Date with dates before 1901


Zend_Date is the Zend Framework module for manipulation of dates. It gives several advantages. Everybody how has dealed with dates knows that built in PHP date function cannot manage dates before 1901. With that kind of problems Zend_Date is pretty fine.

How to do that

If you have only


is not enough. The timestamp is an int representation and the framework cannot get the timezone from that and trows an error.

The simple way to solve the problem

Replace the line above with these: Continue reading Zend_Date with dates before 1901

Flex 3: compare two dates

Theory of Operation

You’re using Flex 3 and want to compare two dates. The format of the dates is string something like “2009 May 05”. The question is …

What’s the best way to compare them

Well if you’ve the dates as strings and you can easily conver them to something like unix timestamps. If they are a Date object you can try lik so: Continue reading Flex 3: compare two dates

Switch from Zend_Loader to Zend_Loader_Autoloader


Zend_Loader was the usual kind of autoloading in Zend Framework before version 1.8. Than simply you say:

require_once “Zend/Loader.php”;

That made all your application to autoload files from the library folder where usualy the Zend Framework stays. That has several things to be changed. Continue reading Switch from Zend_Loader to Zend_Loader_Autoloader