Monday, July 11, 2011

CodeIgniter form helper

Today, I was developing some form generating script for one guy and I need a quick way for creating form. For this purpose I used to use Form class from Nette framework, but I requires a bunch of files etc., so it was a little overkill for my script consisting of exactly one file.

So I remembered, that CodeIgniter has form helper, which was exactly what I needed. But there was problem, this helper was dependent on the framework itself, it was not just "set of standalone functions".

So I stripped it down, removing call for framework and leaving helper file, which can be used as standalone script.

If I remember correctly now, there is only one different to original helper. My helper is set only for 'accept-charset="UTF-8"' but original gets this setting from framework. I was thinking about add possibility to set this, but because helper is a bunch of functions, there is not any static variable you can just set (I wanted to avoid name collisions...). And anyway, who is not using UTF-8 now, right?

But it is on github, so if someone has meaningful changes (like accept-charset, new functions, ...), do not hesitate to commit your code.

There is the link: https://github.com/volftomas/Standalone-form_helper

Statement

I do not really expect someone to read this.

So what is a purpose of this blog?

I need a easily searchable place to store non-private ideas, notes etc.