Creating virtual subdomain with htaccess


In order to create a virtual subdomain in PHP, the following conditions must be fulfilled:
– enabled Apache’s Mod_rewrite module
– existing wildcard DNS record
– properly configured .htaccess file
Read more…

Five reasons why I don’t like php templating engine


Recently, I’ve been asked (yet again) by my superiors to use a templating engine on my project. The main reason for this was so that end users can edit the application templates more easily.
Therein lies the first reason:
Read more…

Embedding relations in Symfony


This quick post describes a necessary step in embedding a relation in a Symfony 1.4 form.
If you have followed Symfony’s official documentation and forums regarding embedding relations in a form, you may have already seen an example of product and productPhoto forms in a single form. Read more…

Creating Autocomplete input field for Symfony based web form


This post describes steps required to create jQuery/AJAX input text field with autocomplete feature using Symfony php framework. It is assumed that you know how to create a web form, and install Symfony plugins, so that part won’t be explained here.
A Symfony plugin sfFormExtraPlugin is required, and, of course, jQuery (I’m using sfJqueryReloadedPlugin). Read more…

Enabling logging in production enviroment for Symfony project


This post describes steps required to enable logging in Symfony project in production enviroment.
By default logging is disabled in prod enviroment, and if you want to enable it, you need to edit settings.yml and factories.yml files in your app directory. Read more…

Getting current route name from template in Symfony


When creating webpages with navigation and menus, it is often nessesary to assign css class for menu item that the visitor is currently viewing. This post shows an example how to get current route name from a template for that purpose. Read more…

Symfony form conditional validation with PostValidators


This post describes how to use Symfony postValidators to create conditional validation of the form.
In this example I’m checking for user_type variable that can be set to person or firm value. If variable user_type has value person, the form should have one set of required fields, and another set for value firm. Read more…