Page 7 of 11 FirstFirst ... 56789 ... LastLast
Results 61 to 70 of 105

Thread: Extremely Easy Ext.Direct integration with PHP

  1. #61
    Sencha User walldorff's Avatar
    Join Date
    Mar 2008
    Location
    Antwerp, Belgium
    Posts
    165
    Vote Rating
    2
      0  

    Default

    And thank you for your excellent work!
    ExtJS 3.4, WAMP Apache 2.2.17, PHP 5.3.5, MySQL 5.5.8

  2. #62
    Sencha User
    Join Date
    Apr 2010
    Posts
    1
    Vote Rating
    0
      0  

    Default Birthday gift

    Wouldn't it be nice if this code would have it's own website where all the documentation could be organised.

  3. #63
    Sencha User
    Join Date
    Jun 2007
    Posts
    8
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by jessec10 View Post
    Wouldn't it be nice if this code would have it's own website where all the documentation could be organised.
    +1 !

    a simple bitbucket/github whatever site would come in handy with no cost involved.
    I think I will never understand why people prefer to spend hours diggin' in a forum and going back and forth to collect and build up their own, subjective little documentation (which differs avg. 25% from those made by others ..)

  4. #64
    Sencha User
    Join Date
    Jul 2011
    Posts
    6
    Vote Rating
    0
      0  

    Default php integration not working with extjs4.0

    Hello, i downloaded ExtDirect.zip and unzipped it into my folder. While I don't get any errors on the Developer Web Inspector window in my browser (Safari, Chrome). The results from the date function is not being displayed. What is the next step? What is the next step? Where should I look? do I need to open additional ports (other then 80) in my firewall?

  5. #65
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlndia, MG, Brazil
    Posts
    106
    Vote Rating
    7
      0  

    Default

    Quote Originally Posted by avishnev View Post
    Hello, i downloaded ExtDirect.zip and unzipped it into my folder. While I don't get any errors on the Developer Web Inspector window in my browser (Safari, Chrome). The results from the date function is not being displayed. What is the next step? What is the next step? Where should I look? do I need to open additional ports (other then 80) in my firewall?
    Do you have PHP and a web server (Apache or Nginx or similar) installed and properly configured? Can you run PHP scripts on your machine? You need to be able to run PHP scripts from your folder, and to see the results in your browser.

  6. #66
    Sencha User
    Join Date
    Nov 2007
    Posts
    2
    Vote Rating
    0
      0  

    Default

    Does not work with ExtJS 4. Here is an updated version of example.html:

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    	<head>
    		<title>Ext.Direct Example</title>
    		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    		<script type="text/javascript" src="http://extjs.cachefly.net/ext-4.0.2a/ext.js"></script>
    		<script type="text/javascript" src="example.php?javascript"></script>
    		<script type="text/javascript">
    			Ext.onReady( function() { Ext.php.Server.date( 'Y-m-d', function(result){ alert( 'Server date is ' + result ); } ); } );
    		</script>
    	</head>
    	<body>
    		<h1>Ext.Direct Example</h1>
    	</body>
    </html>
    And here is an error log from Chrome console:

    Code:
    example.html:4 Uncaught TypeError: Cannot call method 'addProvider' of undefined
    example.html:13 Uncaught TypeError: Cannot call method 'date' of undefined

  7. #67
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlndia, MG, Brazil
    Posts
    106
    Vote Rating
    7
      0  

    Default

    Quote Originally Posted by Blob View Post
    Does not work with ExtJS 4.
    Quote Originally Posted by Blob View Post
    And here is an error log from Chrome console:

    Code:
    example.html:4 Uncaught TypeError: Cannot call method 'addProvider' of undefined
    example.html:13 Uncaught TypeError: Cannot call method 'date' of undefined
    Hi, Blob,

    If you use ext-all.js instead of ext.js, it works.

    Code:
    http://extjs.cachefly.net/ext-4.0.2a/ext-all.js
    If you want to use ext.js, then you need to require the Ext.direct.Manager class:

    Code:
    Ext.syncRequire( 'Ext.direct.Manager' );
    This line of code must be before the Direct API is loaded, like this:

    Code:
            <script type="text/javascript" src="http://extjs.cachefly.net/ext-4.0.2a/ext.js"></script>
            <script type="text/javascript">Ext.syncRequire( 'Ext.direct.Manager' );</script>
            <script type="text/javascript" src="example.php?javascript"></script>
    I have already updated ExtDirect.php by changing the ExtDirect class. I have not published this new version yet, because there are a few other modifications. The change is in the beginning of the "get_javascript_api" method:

    PHP Code:
        /**
         * @return string   JSON encoded array containing the full API declaration
         */
        
    static public function get_api_javascript()
        {
            
    $template = <<<JAVASCRIPT

    if ( Ext.syncRequire )
        Ext.syncRequire( 'Ext.direct.Manager' );

    Ext.namespace( '[%namespace%]' );
    [%descriptor%] = [%actions%];
    Ext.Direct.addProvider( [%descriptor%] );

    JAVASCRIPT; 
    This is backwards compatible and does the job of requiring Ext.direct.Manager in ExtJS 4.

  8. #68
    Touch Premium Member
    Join Date
    Nov 2011
    Posts
    125
    Vote Rating
    1
      0  

    Question Implement in custom frame

    hi all,

    I try to implement this nice class with our framework but I need always a parameter in de registered class.
    I mean this:

    PHP Code:
    <?php

    require 'ExtDirect.php';

    class 
    Server
    {

        function 
    construct__(frame $frame){
           
    $this->_frame $frame;
        }

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

    ExtDirect::provide'Server' );

    ?>
    It results in the follow error
    PHP Code:
     WarningMissing argument 1 for TestClient::__construct(), called in ExtDirect.php on line 501 
    I try to change some things but I am stuck, maybe someone could give me some useful tips?

    Thanks,
    Freez

  9. #69
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlndia, MG, Brazil
    Posts
    106
    Vote Rating
    7
      0  

    Default

    Quote Originally Posted by Kameroliefant View Post
    I try to change some things but I am stuck, maybe someone could give me some useful tips?
    Hi, Freez,

    The easiest workaround would be to provide a default value for the constructor parameter:

    PHP Code:
    <?php

    require 'ExtDirect.php';

    class 
    Server
    {

        function 
    construct__(frame $frame 'default'){
           
    $this->_frame $frame;
        }

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

    ExtDirect::provide'Server' );

    ?>



    In fact, this ExtDirect implementation does not send parameters to the class constructor. The only exception is when ExtDirect::$constructor_send_params config is set to true. But, in this case, the action parameters (coming from the client-side) are sent to the class constructor.

    Anyway, I am open to suggestions on how to provide parameters to the constructor from the server-side... What do you think? Should a new configuration option be created for this? Something like ExtDirect::$constructor_params ? How would it work?

    Maybe like this:

    PHP Code:
     <?php
     
     
    require 'ExtDirect.php';
     
     class 
    Server
     
    {
     
         function 
    construct__(frame $frame){
            
    $this->_frame $frame;
         }
     
         public function 
    date$format )
         {
             return 
    date$format );
         }
     }
     
    $params = array( 'this is the value for "frame" parameter' );
     
    ExtDirect::$constructor_params = array( 'Server' => $params );
     
    ExtDirect::provide'Server' );
     
     
    ?>
    What do you think?

  10. #70
    Touch Premium Member
    Join Date
    Nov 2011
    Posts
    125
    Vote Rating
    1
      0  

    Thumbs up Would be great!

    Hello!

    That sounds very good ! Now I has make a little hack but it always send the constructor parameter.
    If you would implement this you are brilliant!
    PHP Code:
     
    $params 
    = array( 'this is the value for "frame" parameter' );
     
    ExtDirect::$constructor_params = array( 'Server' => $params ); 
    Thanks,
    Freez

Page 7 of 11 FirstFirst ... 56789 ... LastLast

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
  •