Results 1 to 10 of 105

Thread: Extremely Easy Ext.Direct integration with PHP

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlândia, MG, Brazil
    Posts
    106
    Vote Rating
    7
      4  

    Wink Extremely Easy Ext.Direct integration with PHP

    *** Compatible with ExtJS 4 ***

    This is an updated / refactored version of "Easy Ext.Direct integration with PHP"


    How to use:

    1) PHP

    PHP Code:
    <?php

    require 'ExtDirect.php';

    class 
    Server
    {
        public function 
    date$format )
        {
            return 
    date$format );
        }
    }

    ExtDirect::provide'Server' );

    ?>
    Here, "Server" is the PHP class that we want to provide access from the JavaScript code. It could be any other class.

    2) HTML:

    Code:
    <script type="text/javascript" src="ext-direct.php?javascript"></script>
    Here, "ext-direct.php" points to the PHP file shown on item 1. The "?javascript" query string is necessary, because the default output is on JSON format (good for Ext Designer).

    3) JavaScript:

    Code:
    Ext.php.Server.date( 'Y-m-d', function(result){ alert( 'Server date is ' + result ); } );
    Here, to call the "date" method from PHP "Server" class, we prepended the default namespace Ext.php. The first parameter is the $format parameter. The second parameter is the JavaScript callback function that will be executed after the AJAX call has been completed. Here, an alert box shows the result.



    What are you waiting for the download?

    It includes:

    ExtDirect.php - This is the file you include in your PHP script.
    example.php - This is a working sample (PHP part).
    example.html - The HTML and JavaScript parts of the working sample.

    In the next post, I tell you about the features and configuration options.

    Thanks.



    The current latest version is ExtDirect_2011-11-08.zip, which you can download below:
    Attached Files Attached Files
    Last edited by j.bruni; 8 Nov 2011 at 5:31 PM. Reason: New version available (November 8, 2011)

Similar Threads

  1. Alternative Ext Direct PHP Implementation
    By TommyMaintz in forum Ext.Direct
    Replies: 37
    Last Post: 11 Feb 2015, 12:46 AM
  2. Ext.Direct PHP backend
    By ckr in forum Ext.Direct
    Replies: 34
    Last Post: 11 Jun 2012, 1:30 PM
  3. Easy Ext.Direct integration with PHP
    By j.bruni in forum Ext.Direct
    Replies: 2
    Last Post: 23 Jun 2010, 11:27 AM
  4. Simple Ext.Direct PHP apps
    By pkristiana in forum Community Discussion
    Replies: 1
    Last Post: 11 Feb 2010, 1:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •