PhpED: PHP IDE
new features
features
version comparison
features: php tools
php debugger
php profiler
php frameworks
php scripts
features tour
licensing
php testing
PhpED difference
PhpED on Mac/Linux
testimonials
PhpDock
Nu-Coder
PhpExpress
TechPlatform

Ajax PHP Project in PHP IDE

Ajax and PHP in XOAD create perfect combination. You should start the process of getting to know XOAD by putting it in PhpED Project. PhpED's Projects provide great flexibility because they only require the root directory to discover every single PHP File. At this point you should have your Ajax and PHP XOAD framework set in PhpED's Project. If you don't - please read Ajax PHP Project part of this tutorial. You can now learn about the design of Ajax PHP frameworks with PhpED's PHP Debugger.

How to Setup the Project for PHP Ajax code

Before you run XOAD classes in PHP Debugger you should:
  • Unpack XOAD in the directory of your choice
  • Launch PhpED - PHP IDE and create new Project - Project Properties dialog will come up
  • Set Project's Root Directory to be XOAD install directory. Accept other default values and select Ok. Store the Project when prompted and name it "xoad"
Ajax PHP Project Settings
You will see the tree of XOAD files in the Workspace tab of PHP IDE If you look at the source of the output generated by index.php you will see plenty of JavaScript code. This figure shows how this source can be seen in PhpED's PHP Viewer
  • Create new file (File->New, select PHP5 or PHP file type) to implement FirstClass - the class used in XOAD tutorial. Copy and paste the following code into that class:
<?php

class FirstClass
{
  function toUpper($str)
  {
    return strtoupper($str);
  }

  function xoadGetMeta()
  {
    XOAD_Client::mapMethods($this, array('toUpper'));

    XOAD_Client::publicMethods($this, array('toUpper'));
  }
}

?>

Save this file as FirstClass.class.php

  • Create another file to make use of FirstClass. Copy and paste the following, just like it is in the XOAD tutorial:
<?php

require_once('FirstClass.class.php');

require_once('xoad.php');

XOAD_Server::allowClasses('FirstClass');

if (XOAD_Server::runServer()) {

  exit;
}

?>
<?= XOAD_Utilities::header('.') ?>

<script type="text/javascript">

var obj = <?= XOAD_Client::register(new FirstClass()) ?>;

obj.onToUpperError = function(error) {
  alert(error.message);
  return true;
}

obj.toUpper('Hello World!', function(result) {
  alert(result);
});
</script>

Save this file as index.php

How to run PHP scripts using Ajax

Simly open newly created index.php in the PHP Editor and hit Run. PHP IDE will run the PHP Viewer and display the results. Here is your HELLO WORLD box produced with the help of Ajax call to the server side PHP class in PhpED's embedded PHP Viewer: Ajax PHP Hello World

How does PHP Ajax work

Certainly this simple code doesn't shed much of the light on the inner workings on XOAD Ajax and PHP framework. What does the call to XOAD_Client::register do? How is Javascript generated on the client? How is the call to obj.toUpper translated to call of FirstClass method toUpper()? PHP Debugger will now help you answer these questions. You will learn how to use it in the Ajax PHP Debugging part of Ajax and PHP tutorial.

 Download NuSphere PHP IDE

Download a free trial of the fast PHP EDitor and robust Integrated Development Environment for PHP.

 Buy NuSphere PhpED® now

Best PHP Editor and complete PHP IDE.
NuSphere PhpED 18.0 is available from our online store front.
"To be honest its bloody awesome, I have looked at loads of PHP editors and this is THE only one that actual works straight out of the box!!! Brilliant, well done."
Andrew Breward,
Director of Technology
caboodal.com

 Guide

Walk through NuSphere PhpED interface
PhpED video tutorial: Webservices
Learn how to add webservices to your code in less than 5 minutes (a flash demo).

 Special Team4 Offer

Get 4 copies of PhpED for the price of 3!

Optimum solution for development teams.
PhpED 18.0 Team4
Need more than 4 licenses? Contact Us for more quantity discounts, please use "Ordering/Payment issue" subject on the form.

 Dr. Dobb's

Dr. Dobb's

Dr. Dobb's Magazine covers NuSphere PhpED in New and Noteworthy section.

 InfoWorld

infoworld.com
PhpED is a proper, world-class IDE for PHP code. It is the only IDE worth considering if PHP development is your primary job