Entries with the tag "zend framework"

Zend Framework 1 Form Captcha Idea

One of the worst things with CAPTCHAs are actually having to solve them. One of the things my team and I use for our projects is the hidden field CAPTCHA. This is a technique that adds a field to a form, but uses CSS to hide it. If that form value is filled in, we can guess that the submitter was a bot reading the HTML - and not an actual user. (more…)

Using custom view scripts for Zend_Form in ZF1

To start out, I realize that a lot has changed in Zend Framework 2 regarding Zend_Form. I think there have been a number of interesting changes, but perhaps those changes weren’t explained that clearly either. But I digress. This piece is about Zend Framework 1.12.x Zend Form - and using view scripts for elements/the form. (more…)

Zend Framework ACL: Inherits Including

So one of the things that really bothered me about the Zend ACL implementation in 1.x was the inherits() method. It simply would test to see if the current role inherited the roles you were testing against. Well, what if the role WAS the tested role? Then it would fail. So, to fix that, in my own Application_Model_Acl implementation, I wrote inheritsIncluding(). (more…)

Testing Error 500 Pages in Zend Framework

For the most part, ZF can capture any of your hard errors. It will generate an error 500. You’ve seen them, don’t lie… I’ve seen them way too many times. However, in my production application, I capture these with a specific controller. And because I love Unit Testing, I want to make sure that I test my implementation of my omg-this-is-broken setup. (more…)

Extend Zend_Mail to use Views

I love working in the Zend Framework view system. One thing that bothers me, however, is that I must create a complex set of models when trying to send email. I decided that I’d like to move all of this output for the mail class into my own view system as well. (more…)

Zend Framework Use Filter with Paginator

By default, when using the Zend Paginator, the result set will come back as an array. If you are using a paginator associated with a database result set, and that db has a class defined for its row, it will come back as that class. However, if this is not the case, or you are not using information from a database, you may still want a different result than just a plain array. (more…)

Split Read/Write Connections in Zend Framework Database on the Application Level

I’m no sys admin, so I can’t be sure, but I’ve seen lots of issues with using things like MySQL Proxy to fully separate the write and read queries in an application. Maybe it works, I don’t know… but I do know that if I can separate the connections in my code, that saves my Admin time… it doesn’t appear to give that much of a hit to performance either! Do keep in mind that... (more…)

Zend Framework Static Router URLs Not Found in Zend Navigation

For a CMS I’ve been working on, there are a number of custom routes that are added statically in a loop. These point to specific ID’s of articles on on the default module’s page viewing controller/action. Sometimes these routes need to appear in the Zend_Navigation output. As you can probably guess, the logic used for this is similar to what you might experience when using the URL view helper. But, for some reason, I could... (more…)

Zend Framework Authentication: Let the user know if it is their fault

One of the things that is irritating is logging into a website with credentials that you know are right, only to have it fail. Then, later, you find that the site was malfunctioning. By then, maybe you requested a new password, or had to at least waste time looking up your old password. With Zend_Auth, however, we can prevent user’s from having that issue. (more…)

Service Class Methodology

There has been a lot of discussion on forums and throughout the object oriented PHP programming community about service classes. This is just intensified by the Zend Framework model of development coupled with the changes in their design/architecture and vocal spokespeople. I thought I’d throw my hat in the ring for this. (more…)

Zend Framework Front Controllers vs Bootstrap: Round 2

There was some discussion on Twitter regarding the original version of my article about putting most of your site’s setup in the front controller plugins in Zend Framework. However, I haven’t seen a lot of real reasons except for “that’s what the example says” or “this is how I feel.” These suggestions I have are based on performance and logical reasons. However, I could be wrong or maybe I was unclear. So I did a... (more…)

Testing Outgoing Email with Zend Framework

I was creating a new application with Zend Framework at work the other day and I started using my technique that I described here by adding the original email in my email address using the + sign. However, the current organization I’m at has a mailserver (Exchange?) that is either configured not to allow this or just doesn’t have this functionality built in. So, this won’t work. I solved this with a new implementation of... (more…)

Adding Subdomain Routes for all URLs in Zend Framework

All the examples I’ve seen for pulling information from subdomains are from the hostname router directly correlating one subdomain as a value to a single controller/action combo. This means they map username.website.com to something that basically looks internally like website.com/user/profile/var1/username. This is cool for simple one off tasks - however, what if you’re creating a multiple controller/action solution? For my example, I’m creating a CMS that will have a shared code base. However, on every... (more…)

Easy Flash Messenger Messages in Zend Framework

Through reading a few blog posts over the last year and my own trial and error, I’ve developed a way of using the flashMessenger Helper in ZF that works out really well for me. (Note: if anyone knows the original blog post that I got some of the view helper from, please comment!). (more…)

Zend Framework View Helper for QR Codes

Google Charts has a QR code generation service (here are the details). I decided that I wanted to create my own ZF View Helper to display these on my pages. This version that I am going to show just returns the properly formatted URL for the charts API. The view must create the img tag around it. (more…)

Zend Framework: Bootstrap vs Front Controller Plugin

Today I was reviewing some old code I wrote in Zend Framework. One of the things I was doing in the Bootstrap.php file was creating an function called _initViewSettings(). In here I set a bunch of values for the xhtml version, the css files to include, etc. Now I realize my mistake: (more…)

Theme/Template System in Zend Framework

Theme systems are very common in projects written on Drupal, Joomla, and Wordpress. I didn’t see much out of the box support for themes in Zend Framework at first. However, I was wrong. It’s pretty easy. The only real decision I had to make is if I want to make themes that extend a default theme - or themes that are simple and on their own / totally encapsulated. I will do the encapsulated version... (more…)

Zend_db fill in multiple placeholders

I’ve been using Zend_db to create a query which does a simple search on three columns of a table. Fortunately, I found out that the where() statement handles single parameters intelligently when there are multiple placeholders. In the case that there are many placeholders but only one parameter, that parameter will be added to each of the placeholders the same. (more…)

Go to All Posts

Get the RSS for zend framework