Zend Framework

1st August
2011
written by Ricky Stevens

The context of this is actually for ACL, where I wanted to determine whether a use can view the link or not. I have seen other people extend the URL View Helper to do this which kind of works, but it just means the entire <a> tag has to be produced by the helper rather than the URL. This didn’t sit too well with me, so I settled for wrapping the <a> in a IF block. Within my templates I only use the route name, i don’t pass through the module/controller/action params to the URL helper, as it means refactoring modules and controllers is much easier, if the need were to arise. Due to this, I needed to fetch the Module name, Controller Name and Action name from the Route name. Simple eh?

Continue reading “Zend Framework – Get The Module, Controller and Action by Route Name” »

22nd June
2011
written by Ricky Stevens

When using technologies such as Zend Framework and Doctrine, some form of OpCode caching is a must. The average memory used per request with Zend Framework alone is ~30MB, which is a massive performance hit. Doctrine doesn’t fare much better either. My prefered caching mechanism is APC, but there are certain conflicts it has creates when using it with these technologies.

Continue reading “Zend Framework, Doctrine and APC” »

18th April
2011
written by Ricky Stevens

Zend Translate is a great piece of kit, allowing you to switch between translation adapters with the flick of a few keys. GetText is my sin of choice, and that is what I’ll be talking about here. GetText itself can scan over projects and pick up all the translations, and drop them into your PO files. This is fantastic, as long as you stick to the extremely strict methods that GetText defines. But if I’m using Smarty translation blocks, how do I get GetText to pick them up? Because am I hell adding them all in by hand!

Continue reading “Zend Framework – GetText, Smarty and Automatically Adding The Translations” »

7th January
2011
written by Ricky Stevens

Sounds easy enough really, or it should be anyway! When using a routes.ini with the Zend_Router, the concept is you only ever refer to the name of the route, rather than the URL itself. So if you have an awkward client that suddenly wants a URL changed on their website because their “SEO Expert” thought it might be a good idea, you simply change the url against that Route name, and the whole website updates to use this URL. Better than spending several hours going through every page on the website and updating each link manually!

Continue reading “Zend Framework – Get Route Name by URL” »

7th January
2011
written by Ricky Stevens

I’ve recently had a couple of requests for an example project using Zend ACL, so I thought I’d set one up really quickly. I have to say that a lot of credit goes to Dave Clarke who implemented most of the code here at work for our current project. Hopefully this short description, and the example install should help a few people out who are struggling with this largly undocumented ACL-shaped beast.

Continue reading “Zend Framework – Working ACL Example” »

16th December
2010
written by Ricky Stevens

This is something I do quite frequently, normally for AJAX actions that don’t require a template to be rendered on completion. It seems a little pointless creating a blank template just to honor Zend Frameworks proccess of every controller action linking to a template file. Its even worse adding in a die() or exit(), as this completely disrupts the flow of the code. The right way to do it is to simply disable these features, and stop Zend Framework trying to render the templates.

Continue reading “Zend Framework Disable Template Renders” »

7th December
2010
written by Ricky Stevens

Recently at work we came across an issue using Zend Frameworks Form builder – Zend Form. We were creating a form which contained a checkbox and this checkbox had to be checked for the form to be valid. In other words, if the checkbox wasn’t checked, the form should fail validation. Simple Eh?

Continue reading “Zend Framework – Checkbox Required Bug” »

19th November
2010
written by Ricky Stevens

As you may notice the majority of my projects are created using Zend Framework using its Module-Controller-Action structure,  but in a previous existance I developed most of my applications in Symfony.  This was due to Symfony being the framework of choice at my place of employment at the time. Things have changed since then, and the framework of choice at my current employed is Zend Framework. I have however, hung on to a couple of concepts from my Symfony days, the primary one being multiple applications.

Continue reading “Zend Framework – Multiple Applications” »

19th November
2010
written by Ricky Stevens

Zend ACL is a great tool build into Zend Framework, where you can manage Roles and Resources to allow and disallow access to parts of the system. This can either be at module level, or all the way down to individual actions. Several large systems I’ve developed have relied on this access level control structure to manage user priverlages.

Continue reading “Zend Framework Generate ACL Resources” »

12th November
2010
written by Ricky Stevens

When working on any large system with multiple developers, documentation is the depressive task everyone has to undertake. As we work primarally in PHP for our bigger web-based projects, we use PHPDocs which is based on JavaDocs. More on PHPDoc can be seen here – PHP Documentor.

Continue reading “PHPDoc Templates With SVN in Eclipse” »

Previous