Yet Another Coding Blog


Conditional validation of shipping address using Zend sub forms

Zend Framework documentation gives you an excellent example on how to use sub forms. Sub forms let you split the logic of your application into smaller parts, validate it on demand and after collecting all the information validate the whole entity. Pretty cool huh? Lately I was implementing a shopping cart. In the last part of the check out process the user has to provide the billing address and shipping address. Usually they are the same but sometimes they differ. Here is how I solved the conditional validation of the form fields for orders where shipping address differs.


Ubuntu/Debian server with public/private key authentication, PHP-CGI, Lighttpd and MySQL for Zend Framework

I know there are many tutorials which explain how to set up a server in VPS environment. This is probably just another one and it won't teach you anything new. I just want to use this post as a reference, because lately I had to do it couple times for my customers. After completing the steps below you will have a server ready to run Zend Framework backed up by MySQL server. Let's dig in.


Simple image caption with jQuery

Displaying a transparent caption over an image is a nice way to show the visitors what a particular image is about. In this tutorial I will show you how you can accomplish that with less than 50 lines of jquery without downloading any fully featured plug-ins. I will also try to accomplish it in an object oriented way. I tested it in Opera 10.01, Firefox 3.5.1, IE6, IE7 and IE8 and it works great.

You can see a working demo of this tutorial on this page.


Accessing Google Analytics API with Zend Framework

After a long time Google finally released the API which allows the read access to the Google Analytics accounts. Since I needed it to perform some analytics and included it into one of my projects written with Zend Framework. Zend framework provides a massive library collection which you can use to access Google services, but unfortunately it does not provide the interface for accessing the analytics yet. Therefore I decided to share the code.


SMPT authentication with Zend_Mail

It's been a long time since I wrote my last post. Well, I was busy working and getting familiar with Zend Framework. Since the Zend Framework documentation is not really helpful when it comes to send emails using SMTP, I decided I show you how I accomplished that.


Zip code search using jQuery and Google maps – displaying results in a defined radius

Last time I wrote about handling a Google map event, which is triggered, when a user moves around the map. I only mentioned that I had to use this solution for one of my projects, which goal was to display companies branches in a certain distance radius. I decided that it probably will be really interesting for all of you, how to display all company branches according to user input, therefore this time I will show you, how to retrieve the addresses of the places from a MySQL database, based on the zip code and radius provided by a user. I will also split this example in two parts. Todays part will only handle retrieving the results, displaying a simple navigation and markers on the map. In the second part we will push our project a little bit farther and we will allow our user to display the directions from the zip code he or she provided to the branch of his or hers choice.


Google Maps and jQuery – loading markers when user moves the map

Recently I was working on a project, in which the goal was to display all company branches within a certain distance, defined by a zip code and a range provided by user input. The solution was pretty simple. A user provides a zip code and the distance range, the script translates the zip code into geographical length and by using the Haversine formula retrieves all branches from the database and displays them in a Google map. This script was only working when a user submitted the information through a form that was provided for this script. As soon as he or she started to play with the Google map, the information about company's branches outside the initial zip code entered were not updated. When one assumes that a company has for instance 1000 Branches and resides in a small country, displaying other branches, while a user is moving within the Google map may be crucial to their search. I had to come up with an idea, how to solve this problem in my jQuery code. This is my solution.