Set up symfony 1.2 on Debian/Ubuntu

Just wanted to give symfony a try and ran into some issues to set it up the way I wanted. Therefore I’d like to note the required steps.

First, install symfony via PEAR.

pear channel-discover
pear install symfony/symfony-1.2.4

This sould install symfony and make the symfony executable available in your PATH.

~$ symfony -V
symfony version 1.2.4 (/usr/share/php/symfony)

Create a directory for your vhost and create a new project.

mkdir /var/www/myproject
cd /var/www/myproject
symfony generate:project myproject

Create an example application in your project.

symfony generate:app frontend

Link the symfony resources to the project’s document root.

cd web
ln -s /usr/share/php/data/symfony/web/sf/

This should get you up and running with symfony. You just need to configure your server for the vhost. For personal preference, I’d like to have my document root directory named public instead of web. The following steps are needed to achive this.

Rename the document root directory.

mv web public

Add this line to config/ProjectConfiguration.class.php:

public function setup()
    $this->setWebDir($this->getRootDir() . '/public');

    // for compatibility / remove and enable only the plugins you want
    $this->enableAllPluginsExcept(array('sfDoctrinePlugin', 'sfCompat10Plugin')$

Magento: access a dropdown attribute value

In Magento it is possible to access a product’s attributes with a simple getter method. Let’s get the attribute test:

<?= $_product->getTest() ?>

This works as long as test is an attribute of type ‘text’. If the attribute is a dropdown, the method will just return the id of the selected option. To get the dropdown text, you need to call another method:

<?= $_product->getAttributeText('test') ?>

Use PuTTY as Cygwin terminal

Use PuTTY as Cygwin terminal

“Cygwin is a Linux-like environment for Windows.” This means, you can use linux/unix commandline tools like ls, grep and find on your Windows system. However, the default installation of Cygwin uses Windows’ default commandline terminal cmd.exe, which is not really handy. Fortunately, there’s a solution to use PuTTY as Cygwin terminal.

  1. Download and install Cygwin. The setup will download all needed packages, so make sure you check what you need (my main reason to install Cygwin was to have a Git client on Windows)
  2. Download PuTTYcyg and extract the contents of the archive anywhere on you hard drive
  3. Start putty.exe, select Cygterm as connection type and enter - (dash) as command. Enter a session name (e.g. cygwin) in the text field below Saved Sessions and click on Save.
  4. Create a shortcut to putty.exe. Right click the shortcut, select Properties and append the following string to the target field: -load "cygwin". Of course you have to replace cygwin with the name of the session you saved in PuTTYcyg.
  5. Open the shortcut and you should directly get into your Cygwin shell

Magento design resources

As the documentation on Magento is a bit…spread around the web: here’s a collection of links to guides and hints how to deal with magento’s templating system (partially german). I will add more as I find them.


Raumbelegung Update

Wieder ein Update für den Raumbelegungs-Webservice: das Webinterface wurde (zumindest für vernünftige Browser) zum Großteil webzweinulljqueryajaxifiziert ™. Außerdem gibts mittlerweile den Desktopclient in der aktualisierten Version für die neue Basis zum Download auf der Projektseite.

Neue Version des FH Kufstein Raumbelegungs-Webservice

Ich hab mich mal wieder meinem Raumbelegungs-Webservice für die FH Kufstein gewidmet und das komplette System auf Basis des Zend Frameworks neu aufgebaut.

Resultat: der Code ist sauber und wartbar – das ZF nimmt einem einiges an Arbeit ab. Nur der Webservice hat einige Experimente gefordert, bis er mal lief. Ich habe übrigens nicht wie geplant Zend_Soap_Autodiscover eingesetzt, da ich damit kein funktionierendes Ergebnis hinbekommen habe. Im Endeffekt hab ich dann das WSDL-Dokument des alten Webservices kopiert und angepasst, war die einfachste Lösung und funktioniert.


  • Generelle Architektur basierend auf der MVC-Implementation des ZF
  • SOAP Webservice über Zend_Soap
  • Caching mittels Zend_Cache
  • Screenscraping mit simple_html_dom
  • Webclient mit einigen Änderungen beim URL-Handling

Mehr dazu auf der Projektseite.

Disable layout and view renderer in Zend Framework

Just a quick tip: I’m working on a project using Zend Framework and needed to switch off layout and view renderer for a specific controller. This can be achieved by adding the following calls to the controller’s preDispatch() method:

public function preDispatch()

Fetchmail and Sieve with Virtual Mail on Debian Etch

When it comes to mail servers, I really like the setup Christoph Haas describes in his Document Howto: ISP-style Email Server with Debian-Etch and Postfix 2.3. One thing I was missing on a server was the ability to automatically generate config files for fetchmail and sieve from the database in order to get mail from other servers and being able to apply server side filters on incoming mail. This howto is based on the mentioned tutorial.

The additional setup is quite simple: 2 more database tables hold the data for fetchmail and sieve rules and a set of PHP scripts called by cron every few minutes fetches the data and writes it into the appropriate config files. For fetchmail, a script creates a .fetchmailrc file in /home/vmail/. For sieve, another script creates a .dovecot.sieve config file for every user who got sieve rules in the database.

read more »

WordPress Plugin: DateArchives

I just wrote a simple WordPress plugin which creates post archives which are categorized by date. You can find an example of the plugin in action on the new archives page.


  1. Copy the code linked at the end of this post into a new file
  2. Save the file as something like datearchives.php
  3. Upload your new file into your wp-content/plugins folder
  4. Enable the plugin in your WordPress backend


The plugin takes three optional arguments:

void DateArchives ( [ string $headingtag   [, string $splitformat  [, int $limit ]]] )
string headingtag
HTML tag which will be used for headings.
(defaults to h2)
string splitformat
String in strftime format which defines how posts should be categorized. Maybe better to understand if you take a look at my archive page – there I used the default format which results in categories like ‘June 2008’. By changing this string you can categorize your archives by day, month, year, even by hour if you wish so.
(defaults to %B %Y)
int limit
If you got many posts you may want to limit the output to a certain amount of posts. Will output all posts if set to 0 or null.
(defaults to null)

Note: As all parameters are optional, you can omit them all if you don’t need to tweak the plugin’s output.

read more »