Posts by Pieter Vogelaar
Zend Framework – Add custom resource type to autoloader
1This week I wanted to created the folder “application/grids/” to store my grids in. For example the path to the grid is “application/grids/Product.php”. The code inside this PHP file:
You will now get the error “Fatal error: Class ‘Application_Grid_Product’ not found”. The new path must be added to the Zend Autoloader in order to load the required classes. Your bootstrap must look like this:
Auto escape variables in Zend Framework
0In Zend Framework you can use the $this->escape() view helper to escape variables to protect your website against XSS attacks.
Unfortunately, there is no possibility to enable this by default so that EVERY variable is escaped by default. It’s a bit odd because some other popular frameworks like Symfony provide this by default. And Symfony 1 was released earlier than Zend Framework, so you’d think it would be picked up, but no
Ofcourse if everything is escaped by default, there are situations were variables were escaped earlier in the application like a form element. But when you More >
Ubuntu 11.10 – Configure POEdit for Zend Framework
3In this post I’ll desribe how to configure POEdit for Zend Framework in Ubuntu. However POEdit is cross platform compatible and has the same GUI on Windows and Mac, so for these platforms you can also follow several steps below.
If you don’t have POEdit installed yet, open a terminal and execute:
apt-get install poedit
Now start the application with “Alt + F2″ and type “poeditor” and double click the icon. If you start POEdit for the first time, you’ll see the preferences dialog.
Append ” -L php” to the end of the “Parser command:” text field.
PiKe multi translate with Zend_Translate and application.ini
1With Zend Framework it’s not possible to define multiple translate sources for one Zend_Translate instance that will be stored in the Zend_Registry. Also if you want to add a logger to Zend_Translate, it’s not possible to do this only in your application.ini. The closest you get is to define all translate settings, than create a bootstrap method and “extend” the settings and add a instance of Zend_Log with a writer there.
But we made it possible at the PiKe project to define all this purely in your application.ini.
You only need the file following file, or just add More >
Drupal 7 – Exclude node type in search results
1Websites that use the search of Drupal 7 core have now ability to restrict the search and exclude some node types for example. I see some articles that Drupal 8 probably will have this kind of functionality.
However, it’s possible to rewrite the SQL query that selects the search results. Thanks to the Drupal database layer this can be done quite easily.
Show IE6 upgrade warning on your website
0Nobody wants to support Internet Explorer 6 (IE6) these days.
Internet Explorer 6 is over 9 years old, that’s Internet ‘centuries’! It has security issues, does not support some much loved features (such as tabbed browsing) and lacks support for many modern web standards and technologies. Even Microsoft itself says it’s on old browser and users should upgrade. See http://www.ie6countdown.com.
It’s very easy now to show an IE6 upgrade warning on your website and force users to upgrade to IE6. Checkout: http://code.google.com/p/ie6-upgrade-warning. The warning blocks further use of your website for an IE6 user. This way More >