Electricmonk

Ferry Boender

Programmer, DevOpper, Open Source enthusiast.

Blog

Category: php

Templum v0.4.0 released (Simple PHP templating)

I’ve released Templum v0.4.0 Templum is an extremely lightweight, simple yet powerful and fast templating engine for PHP. It re-uses the power of PHP itself for rendering templates, but provides additional features making it easier to write templating code. Rendering templates using Templum is very fast; it approximates native PHP rendering speed for include() statements. […]

Templum v0.2.0: Simple PHP Templating

I just released v0.2.0 of Templum, a simple templating engine for PHP. About From the homepage: Templum is an extremely lightweight, simple yet powerful and fast templating engine for PHP. It re-uses the power of PHP itself for rendering templates, but provides additional features making it easier to write templating code. Rendering templates using Templum […]

Easy PEAR Package creation

Here’s a fairly simple way of creating PEAR package so you can distribute your application or library as a PEAR package. Premise. Let’s assume you’ve written an application or library called ‘MyApp’. The following is a possible directory structure layout: myapp/ |- MyApp.php \- MyAap/ \- MyApp/MyLib.php Install the PackageFileManager. Since writing a package file […]

Templum: Simple PHP Templating

At the company I work for (ZX), we needed a simple yet powerful templating language for PHP. I googled around a bit for something, but we couldn’t really find anything. So I wrote Templum, and ZX was kind enough to allow me to release it as Open Source under the MIT License. From the Templum […]

Links

Here are some random links to interesting stuff: FirePHP FirePHP is a PHP debugging library and a Firefox plugin which allow you to output debugging information to the Firebug debugging panel. Since it doesn’t intermingle debugging information with your page output, but writes in a special HTTP header instead, it’s especially useful for AJAX debugging. […]

Giving up on PHP

I have given up on PHP. I will still need to use it at my job, but in private I refuse to even touch it anymore. Lately, I’ve been busy creating a framework, or a bunch of libraries actually, which where meant to negate some of PHP’s worst qualities. It had better error reporting (the […]

The Unexpected SQL Injection

Something every PHP developer should be reading: The Unexpected SQL Injection – When Escaping Is Not Enough The conclusions: Write properly quoted SQL: Single quotes around values (string literals and numbers) Backtick quotes around identifiers (databases, tables, columns, aliases) Properly escape the strings and numbers: mysql_real_escape_string() for all values (string literals and numbers) intval() for […]

Callback functions in PHP

I was implementing a plugin system for a framework I’m writing, and I needed plugins to be able to register a callback function or method with the Plugin Manager so that the callback function would get called when a signal was emitted. Here’s a very stripped down version of what I ended up with: First, […]

PHP Configuration hell

From the Apache2 configuration file for host example.com: php_admin_value upload_tmp_dir “/var/www/example.com/tmp/” From the file /var/www/example.com/htdocs/test.php: var_dump(ini_get(“upload_tmp_dir”)); Output: string(29) “/var/www/example.com/tmp/” Then, after trying to upload a file, from the /var/www/example.com/logs/error.log: [Sun Sep 02 18:09:05 2007] [error] [client 88.211.179.104] PHP Warning: Unknown: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/www/example.com/) in Unknown on […]

Vim and PHP: tips

I’ve been using Vim for years now, but there’s still new stuff to learn. Check out this page for the PDF version of the slides of a talk given by Andrei Zmievski on editing PHP with Vim. His configuration files are also available. Here’s my favourite list of tips: Add the following text to your […]

The text of all posts on this blog, unless specificly mentioned otherwise, are licensed under this license.