Login   Register  
PHP Classes
elePHPant
Icontem

File: transferevents.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jo Giraerts  >  cjEvents  >  transferevents.php  >  Download  
File: transferevents.php
Role: Auxiliary script
Content type: text/plain
Description: Ajax handler
Class: cjEvents
Handle browser events in PHP
Author: By
Last change:
Date: 2010-08-25 02:14
Size: 1,059 bytes
 

Contents

Class file image Download
<?php
    
include_once 'event.php';
    include_once 
'mycallbacks.php'// the callbacks that are gonna be used to handle the events

    
session_start();

    
$handler cjEventHandler::singleton();
    
    
// Setting up a handler for the events that are coming from javascript
    
$handler->attach('phpevent1''answerjsevent');
    
$handler->attach('phpevent2''answerjsevent');

    
// Work out the events we got from javascript
    
$handler->handleJSEvents();

    
/**
     * Only use this if you are sure that all callbacks that are defined can be called in this script.
     * So you need to make sure everything is set up before doing a call to handle()
     *
     * Best practice would be to collect all your callback-classes and functions in an include-file and instantiate all the objects
     * that serve as callbacks in that file too. This way you can include that file in all the places where you handle PHP-events
     */
    
$handler->handle();

    
// Now send all the js-events from PHP to the frontend
    
$handler->sendPHPEvents();
?>