Topic: Xajax and Kohana

Hey guys, didn't find much on a search here so I figured I would show off how I was able to use Xajax 0.5 with Kohana PHP framework.  Firstly, grab the latest version of Xajax.

I placed the 'xajax_js' folder into kohana/public/js directory, but you can place it elsewhere ( this is just where I stored most javascript ).
I placed the 'xajax_core' and others into kohana/application/vendor, but you can place it elsewhere.

In my controller class, I create a var for the xajax library, and in my constructor...

protected $xajax;

public function __construct()
{
        parent::__construct();

        // Get Xajax library
    @require APPPATH.'/vendor/xajax_core/xajax.inc.php'; 
    @$this->xajax = new xajax(); // Hides any deprecated messages
    $this->_xajax_initialize();
    $this->xajax->setFlag('debug', true);
}

_xajax_initialize method...

// If its the same as code igniter, you cant call a method starting with _ in your url
private function _xajax_initialize()
{
    // Defined for admin template header
    define('XAJAX_INUSE', true);
        
    // Register functions and process request
    $this->xajax->registerfunction(array("doUpdateSelect", &$this, "_updateModelSelect"));
    $this->xajax->processRequest();
}

I decided to use the Template_Controller for displaying templates, but this should work either way.  In the <head> of the template view file, I used...

<?php
if (defined('XAJAX_INUSE') && (XAJAX_INUSE)) 
{
    $this->xajax->getJavascript($URL.'public/js/');
    admin::XajaxStatus();
} ?>

Excuse the admin::XajaxStatus() static method, it simply prints the loading javascript for the little Ajax loading icon.  By using the constant XAJAX_INUSE, I check whether or not I should print the Xajax javascript.

So far everything is working good in Kohana with Xajax.  Hope this helps someone, I love both Kohana and Xajax and it seems to work well with each other.