updates: identi.ca, twitter
The next meeting is July 6th 2009

="sydphp"

Sydney PHP Group provides a community for PHP developers in Sydney, Australia.
Membership is free and open to anyone with an interest in web development.

Now aggregating!

Do you provide web development related services in Sydney and want that information available to the Sydney PHP development community? You can reach our community by getting your RSS/ATOM feed syndicated on sydphp.org

How do I join?

Just attend a meeting, present a topic if you wish or add your thoughts to our blog

Search

Mailing List

The group maintains an announcement mailing list at Google Groups, used to notify members of upcoming web development events in the Sydney region

Events Calendar

Subscribe to the sydphp calendar and receive event notifications as they happen

Flickr pool

July 2009 meeting (author: Sydney PHP Group)

Hi members

July's meeting will be held at Google's HQ in Sydney. Pamela Fox from Google Developer relations will be providing a presentation on the Google Data APIs.

If your apps interface with Google products then this is a great opportunity to pick up some tips and tricks from Google themselves.

Using Google data APIs with PHP


Pamela Fox, from Google Developer Relations, will give an overview of
the Google data APIs protocol on the HTTP level, and then show how to
use it in PHP. The protocol powers many Google products, like
Spreadsheets, Calendar, Blogger, Youtube, Picasa, and Maps, so once
you've learnt it, you'll be able to retrieve and store data in 20+
products programmatically.

Location


Google Sydney Office
5/48 Pirrama Rd
Pyrmont
(note new location !)

Date


Monday 6th July 2009 from 6pm
(note new date !)

General info


Google will be providing light snacks at the meeting. We will be heading out for drinks after the meeting to a local pub.

RSVP


Please RSVP at our Upcoming meeting page

Reminder: note that the meeting date has changed to Monday July 6th.

PHP Web Developer - Inner City (author: sydphp jobs syndication bot)


We are looking for a web developer primary focus on maintaining an
existing internal website written in PHP4.

For someone with web application programming skills, this is an
excellent opportunity to gain exposure to a global company with a
dedicated commitment to delivering exciting new software products.

Managing Hydrodynamic Models presentation now available (author: Sydney PHP Group)

Andrew Goodwin's March presentation on managing hydrodynamic models in PHP is now online at SlideShare.

PHP Developer Position (author: sydphp jobs syndication bot)


Hi,

Real World Technology Solutions ([link]) is seeking to hire a
temporary full-time PHP developer with an immediate start.

The ideal applicant will have good PHP, HTML, JavaScript and CSS
skills. Experience with Object Oriented Programming, Zend Framework,
Linux Operating Systems, jQuery and Prototype would be ideal, but not

Looking for PHP contractors (author: sydphp jobs syndication bot)


I run a small web development business on the lower north shore and am
looking for a PHP developer familiar with Code Igniter to help out
when things get busy.

PHP, MySQL, Code Igniter, JavaScript, AJAX, HTML, CSS are needed

Linux, Photoshop, Flash would all be handy, but not mandatory.

Living somewhere nearby would be a bonus, too.

Simple Amazon S3 Backup script for Apache & MySQL (author: Dean)

While setting up some dedicated servers at the office I needed a quick and easy way to backup each server to an offsite location. After looking around for a while and trying some of the existing S3 backup scripts I couldn’t find anything that satisfied my needs (Apache htdocs & MySQL databases).
So after playing around [...]

Dynamic forms using Zend_Form (author: Rich)

While most forms contain fixed fields there are occasions when you need a form to be dynamic and adjust itself based on user input. The adjustment could be as simple as altering the options in a drop down list or as complex as adding/removing fields. In this post I’m going to cover how to create a dynamic form using Zend_Form and jQuery. I’ll use the example of a registration form that prompts the user for their country and state. The requirements are pretty simple:



  1. It should only prompt for a state if the country has states.

  2. The state list should only show states for the selected country.

  3. The form should degrade gracefully so it works without Javascript


To start I’m going to create a World class. This class has two functions. The first returns a list of countries. The second returns a list of states for a specified country or a list of all countries that have states plus the states in those countries. You might like to retrieve this information from a database but for simplicity I’ll hard code the information into the class.


class World
{
static private $_countries = array(
"AU" => "Australia",
"NZ" => "New Zealand");

static private $_states = array(
"AU" => array(
"ACT" => "Australian Capital Territory",
"NSW" => "New South Wales",
"NT" => "Northern Territory",
"QLD" => "Queensland",
"SA" => "South Australia",
"TAS" => "Tasmania",
"VIC" => "Victoria"));

public function getCountries()
{
return self::$_countries;
}

public function getStates($country = null)
{
if ($country === null) {
return self::$_states;
}
if (array_key_exists($country, self::$_states)) {
return self::$_states[$country];
}
return null;
}
}

Next I’ll create a class for the form (RegForm) by extending Zend_Form. This gives our registration form all of the advantages you get from Zend_Form including input filtering and validation. The form elements will be added in the constructor so that creating a new form is all you need to do to use it.


As our form needs to adapt based on user input the constructor needs to accept the user input as one of its parameters. This allows us to adjust the form elements based on the user input. All code using these parameters needs to be extremely careful as the user input has not been filtered or validated yet.


class RegForm extends Zend_Form
{
public function __construct($world, $params)
{
parent::__construct();

$countries = $world->getCountries();
$countryKeys = array_keys($countries);
$thisCountry = isset($params['country']) ? $params['country'] : $countryKeys[0];
$states = $world->getStates($thisCountry);

$country = new Zend_Form_Element_Select('country');
$country->setLabel('Country')
->setMultiOptions($countries)
->setValue($thisCountry)
->setRequired(true);
$this->addElement($country);

$state = new Zend_Form_Element_Select('state');
$state->setLabel('State');
if ($states !== null) {
$state->setMultiOptions($states)
->setRequired(true);
} else {
$state->setRegisterInArrayValidator(false);

        }
$this->addElement($state);

$submit = new Zend_Form_Element_Submit('submit');
$submit->setValue('Add User')
->setRequired(false);
$this->addElement($submit);
}
}

There are two important things that RegForm does:



  1. The state options are adjusted to match the selected country.

  2. The state is not validated if the country does not contain states.


This means that our form will work exactly the way you expect Zend_Form to work. Without Javascript if you select a country and submit the form then the state list will adjust and display an error that the previously selected state was invalid. After you select a valid country and state the form will validate. If the selected country does not have states then the form with validate regardless of the selected state (providing there are no other errors).


I then need to create the controller.


class AccountController extends Zend_Controller_Action
{
public function indexAction()
{
$params = $this->_getAllParams();
$world = new World();
$form = new RegForm($world, $params);

        if ($this->_request->isPost() && $form->isValid($params)) {
// The form was valid!!
}
$this->view = $form;
}
}

Finally we can add Javascript to alter the form in browser. If you’re using the forms render() function then the Javascript will look something like this.


    var countries = <?php echo json_encode($this->world->getCountries()); ?>;

var states = <?php echo json_encode($this->world->getStates()); ?>

function updateStates() {
var state = $("#state");
var country = $("#country");
var hasStates = false;
jQuery.each(states, function (cc, slist) {
if (cc == country.val()) {
hasStates = true;
state.html('');
jQuery.each(slist, function (code, name) {
state.append('<option value="' + code + '">' + name + '</option>');
});
}
});
if (hasStates) {
$("#state-label").css("display", "block");
$("#state-element").css("display", "block");
} else {
$("#state-label").css("display", "none");
$("#state-element").css("display", "none");
}
}

    $().ready(function () {
$("#country").change(function () {
updateStates();
});
var state = $("#state");
if (state.val() == null) {
$("#state-label").css("display", "none");
$("#state-element").css("display", "none");
}
});

This code takes care of hiding the states if they are not required and adjusting the states based on the selected country without needing to submit the form. With minimal effort I’ve been able to create a dynamic form using Zend_Form to do most of the hard work. Users with Javascript enabled get an A grade experience while those without Javascript can still use the form.


Senior PHP/MySQL Developer, $75K base (author: sydphp jobs syndication bot)


Life Events Media is a young dynamic company based in Ultimo, Sydney,
and we’re passionate about building a great online experience. We have
recently launched our flagship product Quotify.com.au and are now
expanding internationally.

With our expansion, we’re looking for the right developer to help us

Casual PHP/MySQL developer with a great startup in Ultimo, $30 per hour over holidays (author: sydphp jobs syndication bot)


$30 per hour over holidays, immediate start, flexible to fit with your
needs. To apply, e-mail us your CV or call us on 8005 3605

Life Events Media is a dynamic young startup company based in Ultimo,
Sydney. We've been running our website Quotify.com.au since 2006 and
are now looking for a talented developer with PHP and MySQL experience

PHP Developer / Western Sydney / High Transaction Online Environment (author: sydphp jobs syndication bot)


Currently seeking an experienced PHP/MySQL Developer. Exciting
opportunity with a high transaction online environment, based in
Western Sydney. Please contact via m...@happener.com for more details
and applications.