 | News Feed |
Sections
|
| feed this: |  |
NETTUTS.com: Creating a Dynamic Poll with jQuery and PHP
by Chris Cornutt July 25, 2008 @ 10:22:05
The NETTUTS.com website has a new tutorial posted that combines PHP and AJAX (using the the jQuery library specifically) to create a simple dynamic poll.
When you combine some neat functionality courtesy of PHP with the cleverness of jQuery you can produce some pretty cool results. In this tutorial we'll create a poll using PHP and XHTML, then make use of some jQuery Ajax effects to eliminate the need for a page refresh, and to give it a nice little bit of animation.
The PHP handles defining the question, answers and the functionality to load, submit and return the current results (number of votes) back to the javascript. The communication between the PHP and javascript is a JSON message made simple thanks to PHP's json_encode function.
You can download the source or check out a live demo to see how it all fits together.
voice your opinion now!
jquery javascript json poll dynamic demo download tutorial
Brian Moon's Blog: Stupid PHP Tricks Normalizing SimpleXML Data
by Chris Cornutt June 03, 2008 @ 09:34:22
Brian Moon has a "stupid PHP trick" posted to his blog today - normalizing SimpleXML data you've pulled in from just about any external source.
Anyhow, one annoying thing about SimpleXML has to do with caching. When using web services, we often cache the contents we get back. We were having a problem where we would get an error about a SimpleXML node not existing.
They were using memcache to store the information but came across problems when their code tried to use a (sometimes) empty tag. He gives two solutions - one using a recursive function that identifies the empty items and the other that encodes then decodes the object to and from JSON, keeping the values intact.
voice your opinion now!
trick stupid simplexml normalize json recursive empty tag
Marco Tabini's Blog: 5 PHP 5 features you can't afford to ignore
by Chris Cornutt April 29, 2008 @ 17:06:45
Marco Tabini has posted his list of what he considers five features of PHP5 that you "can't afford to ignore" when doing your development work:
Despite the fact that you may not have a choice in the matter, upgrading comes with a number of bonus new features that can help you write better code and gain access to new functionality that required a fair amount of hacking in previous version. Here's a quick list of 5 personal favourites.
The feature to make his list are SimpleXML, JSON/SOAP, PDO, the Standard PHP Library and SQLite. Each has their own bonus feature(s) included too for a little extra incentive to check them out.
voice your opinion now!
php5 feature list ignore simplexml json soap pdo spl sqlite
Michael Girouard's Blog: Rolling Your Own MVC The View
by Chris Cornutt April 28, 2008 @ 09:39:45
Michael is back with part three of his series stepping you through the creation of your own MVC framework (Part 1 and Part 2) with a look at the part that interfaces with the user - the View.
Using the view as a starting point may seem odd at first considering the view-related actions are some of the last steps in the page load scenario, but since our views don't have any external dependencies, unit tests are very easy to write and so is the accompanying code.
He explains how views work along with the rest of the framework and some of the basic rules surrounding how they get their data. Code comes along with the explanations for different views like XML, HTML and JSON methods of output.
voice your opinion now!
modelviewcontroller mvc view tutorial output xml html json
Cal Evans' Blog: I called Zend_Jsonencode(), so WTH are all my properties?
by Chris Cornutt February 22, 2008 @ 12:10:00
In dealing with a little JSON encoding and objects in a project of his recently, Cal Evans bumped against a problem when he was encoding an object and moving it back and forth between the back and front ends.
The problem is simple, JSON encode a PHP object and send it back to the front end. Sounds simple and the last 100 times I wrote this code it was simple. This time, I was too smart for my own good. Here's the scenario.
He illustrates his problem - the "dropping" of properties somewhere along the way - with a sample class that encodes the object and sends it along. He missed one key bit of information, though. His protected array of properties wasn't getting passed back out correctly and we're in the resulting JSON message. A quick hack of a getProperties() function call made this problem a thing of the past.
voice your opinion now!
zendframework json encode property getproperties problem
|
Community Events
Don't see your event here? Let us know!
|