Using a DB validator in Zend_Form

Doing some work on a little project of mine while waiting for the keynote to start. What I’m doing is writing a form that needs to make sure that a record is unique in the DB. Doing that in ZF is really easy. Simple set your validator as Db_NoRecordExists. What this does is during the Zend_Form::isValid() functionality it will query the database as part of the validation process. The only parameters you really need are the table and the field if you have already set a default adapter for your Zend_Db models. That makes it really easy to use. Here’s a slice of how I did it.

Zend_Amf and Flash Remoting – Some things to note

Having done a little bit of work with Flash over the past several weeks there are a couple of things I’ve discovered as I’ve worked through some practical examples. There’s only really one thing signficant, but a couple of things that you need to be aware of when doing Flash remoting with Zend Framework.

Simple interface? Easy. Useful interface? Just a little harder.

In other words, with a simple architecture it’s easy to do. In a more useful architecture there are some things to be aware of.

For the Flash developers – building your remote endpoint

While I am not a great Flash developer… OK I’m not even a good one, I have been recently been looking at ways of integrating Flash and PHP with the release of Flash Builder 4. I think that PHP is a great way for Flash developers to access their backend systems. This is not because I have anything against any other technologies that a Flash developer might connect with, but instead it is because PHP is a great language to use when another language is your forte.

Pre-caching PHP content with Zend_Cache_Manager and the Zend Server Job Queue

With the web being what it is today there can be a lot of times when you want to aggregate data from many different sources and bring them together in a single page. I have not done much of that on my site simply because that means that I then need to learn a bunch of different API’s. However, since Youtube is the #2 search engine I figured that it might not be a bad idea to aggregate some of my YouTube content on my page automatically. I don’t necessarily want to do a blog post about each individual video I post, but I wanted there to be some place where I could just list them out.

Creating a separate mobile layout for a Zend Framework application

I’ve got a Pre… and Sprint. Together they make for a pretty poor browsing experience. More due to the Sprint part I presume since browsing the web is a painfully slow experience. The Pre has other problems. That poor browsing experience has extended to the e_eschrade website for me even though there aren’t a lot of elements that need to be loaded. So to get around that I decided that it was time to make my site (mostly) mobile friendly.

Setting up a maintenance page with Zend Framework

One of the things that smaller sites who don’t have a fully redundant setup or a relatively minimal deployment mechanism need to do when doing some kind of maintenance is put up an “Under Maintenance” page. That or there was some massive problem and you need to just shut down access to the site while you fix the problem. With that in mind I have written a very simple example that allows you to create a maintenance page that is configurable and requires no changes to your existing site. This example uses Zend_Application, but all of the code can be used in a pure Zend_Controller application by adding the plugin however you normally add plugins.

Added Gravatar

Gravatar is a service that allows you to have a world-wide available avatar based off of your email address that can be used any place where you post comments or do anything really. It is based at gravatar.com and it is free and easy to use. Github uses it for their avatars. And now, so does e_schrade.

The way it basically works is that you create an MD5 hash of the email address, so the spambots can’t get it, and point that to the Gravatar website inside of an img src. The code for building it is really quite easy.

Little Schrade asks about Flash and Zend Framework

Following closely on the heels of my previous blog posting on how to create a basic Hello World application using Flash RIA with Zend Framework based remoting I have created a video showing how to do exactly what I just did in the blog posting. Additionally, I have a compressed copy of the workspace I used so you can download it and run it in your own copy of Zend Studio. You will probably need to change a few settings to make it work in your IDE. Be forewarned that you will likely also need the Flash Builder 4 plugin installed. The 60 day trial should be more than enough to let you do that.

Flex and Zend Framework – Part 1

It would be a fair statement to say that I have not paid attention to Flash for several years. Obviously I know that those awesome interfaces for movie web sites are made in flash, as are those annoying video ads that start screaming at you as soon as you load up a page, competing with Megadeth on Rhapsody, cranked out on the 700 watts of power I have in my office. But the last time I really looked seriously at Flash was almost a decade ago and I was thrilled at tweening widgets from one place to another. Unfortunately, there’s not really any benefit to tweening a text box. Cool? Yes. Practical? No. So I never really picked it up. Plus I was cheap.