Posting source code in WordPress: escaping and syntax highlighting the inserted code

Date November 4, 2007

I have already mentioned that I had difficulty in finding a suitable solution to post source code in my blog. However good the workaround presented in my previous post is functioning, I was not satisfied with it. I noticed two annoying things. The first was that I had to escape HTML special chars “manually” in the inserted code, which was a pain in the ass. My second problem was (I like to indent my code with TAB) that indentation was too wide, which looked not really nice out (and was impractical when your code has multiple nested control structures). After a little JavaScript hacking and playing with GeSHi and CSS I solved both of them. Read the rest of this entry »

Symfony form handling recipe

Date November 3, 2007

Symfony is a really great and well-thought-out framework, but I think its form handling support needs some more improvements. 5-6 years ago I developed an MVC framework as my thesis which has the following features related to form handling:

  • You can define forms logically (including labels, validation rules, error message parameters etc.) via form configuration files. The developer module provides a web based front-end to edit these files in a convenient way.
  • You have an API to create or modify forms from program code (add extra validations rule, add/modify/freeze elements etc.), this could be very useful.
  • A form can render itself via renderer objects, so you can insert a form to a template adding only one line to it. Generally you should only set up a few renderer object per project, they can be reused.
  • The framework validates forms automatically, it can generate client side validation code too. It redisplays the form on errors with the error messages.

It would be great if symfony came up with something similar, I found these features very handy. After this little introduction (feature request ;) ) let me show you a solution how you can effectively handle a form for creating and modifying something. Read the rest of this entry »

Escaping problem with WP-Syntax WordPress plugin

Date October 30, 2007

When I started this blog I had spent some time finding a syntax highlighter plug-in for the code snippets presented in the posts. I went to wordpress.org and I tried out some of the plug-ins, but I had some problems with all of them. After a few hours I found the WP-Syntax plug-in. I had had already some positive experience with the GeSHi (Generic Syntax Highlighter) library, and I liked the demo on the EmacsBlog so I thought this is what I wanted. Read the rest of this entry »

NEON – Zend Studio for Eclipse

Date October 27, 2007

A couple of days ago Zend announced the beta version of NEON, the Zend Studio for Eclipse, based on PDT. NEON is now a rich featured IDE for PHP developers, which supports the full development life cycle. I will cover now the most interesting parts of it, which ones could be useful for PHP developers, but NEON has a lot of more advanced features (like web service editor) which ones I will cover in later blog entries. Read the rest of this entry »