Archive for category Zend Framework

Keeping your HTML valid with Zend Framework, Tidy and Firebug

With Zend Framework there is an easy way to ensure that you always create valid HTML in your applications. This involves the use of a simple Front Controller Plugin, and the php Tidy component.

Valid HTML is important for a great many reasons, the most important of which is ensuring consistency across all of your visitors browsers. The first step to making sure that your site appears correctly on all the browsers is to ensure that your HTML is valid. Even if the goons at Microsoft continue to ignore the standards and do their own thing, if you at least ensure your html passes validation, then fixing things for Internet Explo(r|it)er of all its versions is a far easier task, and usually possible with a few simple extra styling rules in your CSS.
Read the rest of this entry »

20 Comments

Massive zend framework poster \ cheatsheet

The other day, a wonderful thing arrived in the post, fresh from Björn Schotte of mayflower.

The poster covers many of the commonly used components, and their parameters. I have had it on the wall for about 2 weeks now, and it has become something of a crutch already, and makes it very handy to quickly check, for example whether it’s dispatchLoopShutdown or dispatchLoopShutDown in a FC plugin, or what the parameters for the headLink helper are (two things I always have to double check!)

Mayflower is a partner of Zend, and offers many training and consulting services for PHP companies, as well as developing their own software solutions, such as the “Chorizo!” security auditing suite, and consulting for the popular lightweight webserver “lighttpd”.

Check out the mayflower site at http://www.mayflower.de/en, and drop Björn Schotte an email if you are interested in a poster of your own, he may have some left!

4 Comments

Creating simple, extendible CRUD, using Zend Framework

The Form

Creating a nice, easy to maintain form, starts with a form class. Creating your forms procedurally in your controller/actions is horrid. please don’t do it.

To start with creating your form classes, you need your own namespace in your library. If you don’t have this, register one. This can be done by adding an _initAutoloading method to your Bootstrap. below is a short example. its not comprehensive (you can also do this in your ini i believe, but I use php configuration files similar to DASPRiD’s, and i’m not trying to show how to set up autoloading here.) Read the rest of this entry »

21 Comments

Why the Zend Framework Actionstack is Evil

The action stack seems to be a useful component to some people when starting out with the Zend Framework. This component is a seemingly un-needed part of the framework, as there really is no use-case for it which cannot be simplified with the use of a partial view, which reads data directly from the model, possibly with a view helper alongside to provide some additional logic function, such as deciding on which view partial to use.

This part of the Framework causes the dispatch to loop. This is a costly process, as it involves quite alot. It also adds some further issues to your application design, such as where you should put code. for example if you have some code in your predispatch, and your looping through two actions in that controller, that code will be run twice. This is obviously, not good, and quite un-needed. Further complications can be added when it comes time to add ACL or authentication.

Read the rest of this entry »

, , , , ,

28 Comments

Zend Framework, Zend_Dojo and Dojo Tree

Working on a new CMS at work, I needed to allow a user to insert a page at a point in the site tree. And i thought to myself, well, Dojo has a tree widget, and Zend Framework supports dojo, it can’t be a difficult task.

Unfortunately I was unable to find a ’simple’ method of doing this already documented, so I experimented a little, and threw away some very in-elegant ideas, and finally came up with the following technique, after discovering the Zend_Dojo_Data.

Read the rest of this entry »

2 Comments