 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
John Maver's Blog: How to create a Bebo application using PHP 5
by Chris Cornutt May 12, 2008 @ 17:21:17
In this new post on his blog, John Maver gives a step-by-step guide for creating a PHP5 application for the popular social networking site Bebo.com.
I have been answering a lot of email requests for how to get started with a Bebo application. Since applications can be written in any language that supports interaction with the Bebo REST API, developers have a lot of choices in how they build their application. The focus of this article will be on the "officially supported language" - PHP.
He defines the parts of the application first (the callback, canvas page, profile box, invitation and news stories). Much like the Facebook API, the Bebo system has you host the application on your own servers and use their developer libraries to interface with their systems. He makes a simple application that has a "story" published to it that shows to each visitor.
He also tosses in a method for knowing a bit more about the user - like if they've just added the application, if they're a normal user or if they've just removed it from their application list.
voice your opinion now!
bebop application php5 tutorial callback canvas profile news invitation
Developer Tutorials Blog: PHP array_walk() Run an array through a function
by Chris Cornutt April 23, 2008 @ 08:47:09
The Developer Tutorials blog has a quick example of how to use the array_walk function to maneuver through the array of your choosing and applying a callback method to each of its elements.
It's a common sight: taking an array and running (well, walking) its elements through a particular function. Luckily, PHP provides a simple yet powerful function to overcome this: array_walk().
They include an example, giving a sample "some_function" the array_walk method uses when it's called, replacing a foreach (or other type of loop). Plus you can specify an object with the callback to run it against a method inside a class too.
voice your opinion now!
arraywalk function callback object method loop tutorial
Alexander Netkachev's Blog: Practical PHP events
by Chris Cornutt October 24, 2006 @ 07:20:48
In his latest tutorial, Alexander Netkachev shows how to, with some of the simple PHP functions, create an event system for your script, complete with callbacks.
The way how events are raised and how listeners are attached on the events is a part of a core in many modern applications. It plays an important role in some enterprise design patterns (MVC, for example).
He starts with the basics of event handling - some of the terms and descriptions of basic functionality that any good event handler would have. He describes the most common setup of an event-interaction relationship. Then, it's on to the code, showing first three different ways to call functions (by name, by variable, and by callback).
He finishes it off with a functional example that responds to a a call to fireEvent (five times) and handles each by calling the function in the callback information (myFunction).
voice your opinion now!
event handline callback tutorial basics calling methods event handline callback tutorial basics calling methods
Joshua Eichorn's Blog: Webthumb API additions
by Chris Cornutt October 02, 2006 @ 16:13:01
In light of the popularity of his WebThumb site thumbnailing service, Joshua Eichorn is implementing a new feature to help reduce the number of requests to the server. The most popular request is made to see if a thumbnail is ready, and the new feature - a GET callback to the server making the request - will help to reduce them.
If you wondered an API that requires polling isn't a very good thing for scalability. On my current setup I can pretty easily handle about 20 status requests per second on top of my normal traffic, the problem is its not hard for a bad polling implmentation being run by one user to make that many requests.
To solve this problem im adding an addition to the Webthumb API that will allow you to skip polling all together. The basic idea is that your make an API request and when your thumbnail is complete i'll make a GET request back too your server telling you that the request is complete.
It's a simple matter of including a new "notify" tag in the XML message to the server with a URL to make the callback to. He even includes some sample PHP code to get you started with the new feature. The script handles the automatic download of the thumbnails when called from the WebThumb service.
voice your opinion now!
webthumb api callback notify message sample webthumb api callback notify message sample
Felix Geisendörfer's Blog: Welcome to the Dark Side of Plugins in CakePHP
by Chris Cornutt June 26, 2006 @ 06:27:28
CakePHP users out there looking to squeeze just a bit more out of their plugins might want to check out this new post over on Felix Geisendörfer's blog today. He shows how he's worked around two issues that have bothered him with the current framework setup - inter-plugin communication and filter callbacks.
He starts off by looking at the filter callbacks, looking to make "drag and drop-able" plugins for his setup. He notes that, right now, you'd have to call a plugin to perfom an action, making for a good bit of load depending on the application structure. It also means that you have to change the Controller to add a new plugin ("...which doesn't seem like a very RAD approach to me").
So in order to streamline such plugin callbacks, I created a function inside SpliceIt!, that allows plugins to hook into any AppController event, such as beforeFilter, afterFilter, beforeRender, etc. in order to make their own changes to the controller. So a Themes plugin can easily change the Controller::view and a Statistics plugin can make calls to a Model.
He gives the code for the function as well as an example of how to use it in your app.
Moving on, he looks at his next issue to overcome - inter-plugin communication:
Generally spoken Controller::requestAction() isn't a bad way to exchange data between controllers. It's a clean interface and you don't have to plan in advance what data should be exchangeable and what data should not. However, there are a couple problems with it.
His solution involves the creation of an entirely seperate ApiController pattern. Of course, he provides examples, specifically related to his SpliceIt! application.
voice your opinion now!
cakephp framework mvc plugin callback hook inter-plugin communication cakephp framework mvc plugin callback hook inter-plugin communication
PHPit.net: Having fun with PHP's output buffer
by Chris Cornutt April 17, 2006 @ 07:13:24
One of the more powerful and handy features that PHP offers is output buffering. It allows you more control over when the client's browser gets the information instead of just spewing information at random. It is a little tricky to get the hang of, so PHPit.net has put together this new tutorial on how to get started.
I'm sure most of us have come across the dreaded "Cannot modify header information - headers already sent", and this is usually caused when your script tries to send a header or set a cookie, when it's already sent output. The easiest fix is to make sure no output has been sent, but it's also possible to enable something called output buffering which also solves the problem.
In this article I'll first show you how output buffering works, and take you through most of its basic functions. After that we'll have a look at what's possible with output buffering, and show you some neat tricks.
The groundwork is laid first, giving a simple "Hello world" example to show how the code flows. They show how the buffering system works and how to use a callback function to modify the contents of the buffer before outputting (including a full replace function to text within the buffer from an array). They follow that with a look at creating your own HTML tags and using the gzip compression functionality to speed up your pages.
voice your opinion now!
php output buffering example tutorial simple callback replace gzip php output buffering example tutorial simple callback replace gzip
|
Community Events
Don't see your event here? Let us know!
|