ThinkPart

Andrey's blog

 

Zend_Form madness

 

It all started with a tutorial from Rob Allen, maybe from his book "Zend Framework in Action". A simple site to organize a CD collection list. Zend Framework seems very powerful but it will be insanity for someone to understand it without a tutorial of some kind.

Probably it started as a small project, it looks now like a behemoth. From the tutorial it seems the different parts are quite well integrated. Zend_Config can be used in various places but I am not the real fan of using INI files to store settings. Don't get me wrong, I like settings files but not text ones to parse. PHP's interpreter and its friends, all the bytecode cache are, quite good at using native define()-s or arrays.

I followed the tutorial made changes, as I wanted to really get the feeling of that software. A lot of magic. I don't feel comfortable with all that magic. I _just_ feel quite better when I understand what happens. Yes, I don't understand what every bolt in the cars I ride do but when it comes to my area of expertise, the computers, I should know. Anyway. nobody is born ready for programming.

My current fight is with Zend_Form. I want to make the Submit button in a simple form an image. Pretty easy it is with simple HTML, however with Zend_Form I don't find an example. Weird :(. Anyway, Zend_Form is everything but the kitchen sink, this makes it powerful, I like it. Better documentation would have been good. The documentation online is not bad, at least the code is documented. Bravo for Zend's documentation team but please more examples, tons! A picture is worth more than thousand words, an example too!

Very good presentation, from the Zend_Form author can be seen on SlideShare here.

 

Enjoy!

P.S.

Whoever has the answer to my problem, Zend_Form and submit button that is an image, maybe with an Image decorator if I understood the concept at minimum, please post. That would be great!

Responses (6) to "Zend_Form madness"

  1.  

    Adding element type "Image" (e.g. Zend_Form_Element_Image) doesn't help ?

  2.  

    Interesting article... I love Zend Framework, but sometimes I to get frustrated over some things.

  3.  

    Pass your image tag as the label of the element, and then make sure you set the 'escape' property of the element to a boolean false. You can do this by passing an 'escape' key in the configuration options you pass during instantiation, or by calling $element->setParam('escape', false).

  4.  

    weierophinney: Thanks. I succeeded, it wasn't that hard, had to use Zend_Form_Element_Image. Found that there is a IRC room about ZF at freenet (#zftalk), from your slides from the Dutch PHPConf 08.

  5.  

    Obvsiously there is a learning curve in Zend_Form, but it is very powerful: I'm currently working on autogenerating fields and validation from domain objects.

  6.  

    Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I'v just started to learn this language wink
    See you!
    Your, Raiul Baztepo

Leave a reply

Comments are disabled for this post.