RSS feed - Using POG with Flex
- Optimizing your web application
- Regenerating large objects
- PHP4 or PHP5
- New and Improved
- Evolution of a cube
- POG Museum
- POG 3.0 alpha
- Initial Performance results Part 2
- Initial performance results
- Proposal: POG 3.0 object model
- Suggest a feature
- A new year, A new POG release
- Many-Many relations
- POG 2.5 Released
- POG 2.5 beta
- Automatic table alignment
- New version: 2.1.2 released
- RSS should work well now
- RSS feed glitches
- What's new in 2.1.0
- PHP Objects 2.1.0 (preview)
- PHP Object relations FAQ
- PHP Object Relations
- Searching base64 encoded text
- How to debug POG-generated objects
- POG UI Tips
- Featuring Of Interest links
- PHP CRUD
- POG 2.0.1: A better code generator
- A look at the POG SOAP API
- POG 2.0.0 released
- Coming soon: Generate parent-child objects
- Generated abstraction v/s dynamic abstraction
- Zend Framework preview
- Coming soon: Generate Objects through SOAP
- Easily save images and files to a database
- PHP, Paypal & POG
- Five advanced Code Generator tips
- PHP Pagination using generated objects
- PHP Code Generator benchmarks
- Representing database objects using an AJAX Tree interface
- Using SETUP in a production environment
- Description of the generated object package
- Introducing PHP Object Generator version 1.6
- Using AJAX and PHP Object Generator
- When to use Object->SaveNew()
- Generating PHP objects in 2006
- Happy Holidays
- A short video of the POG Setup process
- A sneak peek at POG 1.6
- POG Tip: Field limits
- Previous versions.
- Searching the blog and tutorials sections
- Generating code with "Other" SQL data types
- Five general POG tips
- POG source code locations
- Microsoft SQL 2005 Express Edition
- Impatiently awaiting PHP 5.1 and PDO
- Php Object Generator goes open source
- POG generates PDO compatible code
- Oracle to offer free database
- POG Google group
- Database Wrappers and POG
- Revisions
- The generator blog
- An explanation of the 'Escape' function.
- Mirror, mirror
- Using POG to solve real world problems
- A php object-relational database tool
- A simple and flexible Object Oriented approach to PHP
Back to the Code Generator
The POG Google group
The POG tutorials/code samples
The POG mirror site
Using AJAX and PHP Object Generator
written 1513 days agoAJAX, as you must have heard already, is a set of not-so-new technologies (Javascript, XML, CSS) which allows developers to design web applications with minimal server post-backs. The main difference this technique offers over “traditional” or “Web 1.0” applications is a more responsive and interactive graphical interface, since browser-server interactions occur behind the scenes without the need for a page refresh.
All the examples provided up to now in our tutorials have dealt with traditional scenarios: Usually a web form, PHP objects generated by POG and some plumbing code that joins them together. In this article, we’ll demonstrate how POG can also easily be used with an AJAX UI to create a simple to-do list. But first, if you’re not familiar with concepts related to AJAX, we recommend that you read this short article which gives a 30 second AJAX tutorial.
Using POG and AJAX is not much different than using POG and regular HTML or XHTML, because essentially, in both cases, you’re dealing with PHP objects in the back-end. Whatever happens in the front-end, whether there’s a server post-back or not, is quite irrelevant. For example, let’s say you’ve created a form that captures to-do items that are used to build a to-do list. The method used to post the input to the PHP objects doesn’t really matter, as long as they’re passed correctly. In the examples provided in our tutorials, we use plain html forms and server post-backs to pass the required information. In this current article, we’ll use AJAX.
Take a look at the live example below:
In this example, whenever the “Add” button is clicked, the page makes a call to the javascript function sndReq with 2 parameters: action and todo. The sndReq function then asynchronously passes these 2 variables to rpc.php in the background. In rpc.php, we’ve added some code to handle 2 types of actions. If action is “Add”, then we create a Todo object, assign the value of todo to it, and save it. If action is “Get”, we simply get the last 5 to-do items and return them. If you followed the example on the 30-second tutorial site, you’ll notice that we essentially plugged in POG-related code in rpc.php to save and retrieve Todo objects. For aesthetic reasons, we also used a “Yellow Fade Technique” script to briefly highlight the most recently added to-do item.
Download the source code and take a look for yourself.
- Extract the zipped file into a folder on your server.
- Edit configuration.php with your database details.
- Run /setup/index.php and complete the 3 steps.
- Finally run /index.php and you should be able to add items to your to-do list.
We hope this provides somewhat of an overview of how POG can be used with AJAX web applications as well as traditional web applications. Whichever method you choose or prefer is your personal choice.
Additional Reading:
Here’s some additional links somewhat related to this post:
The Fade Anything Technique
The Yellow Fade Technique
moo.fx (super lightweight javascript effects library)
Prototype Javascript framework

This is a weblog about the Php Object Generator (POG) project, OO PHP, databases and Php code generators in general.
Php Object Generator, (POG) is an open source PHP code generator which automatically generates clean & tested Object Oriented code for your PHP4/PHP5 application.
Subscribe to our RSS feed
Feedback, Feature Requests, Bugs to:
The POG Google group
Send us a Hello through email