Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 38

Thread: Alternative Ext Direct PHP Implementation

  1. #21
    Sencha Premium Member
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,675

    Default

    Hi Tommy,

    something is missing in your implementation, and it belongs to file upload.
    Please have a look to our TYPO3 implementation i posted some minutes ago (when it is reviewed - why are new posts here are reviewed?)

    Just in short:

    in Router:
    $data->data = array($_POST, $_FILES);
    should read
    $data->data = array($_POST + $_FILES);

    and for the response of file uploads you will need something like
    Code:
    $response = json_encode($response);
    $response = preg_replace('/"/', '\\"', $response);
    
    $response = array(
    	'<html><body><textarea>' .
    	$response .
    	'</textarea></body></html>'
    );

  2. #22
    Sencha User
    Join Date
    Jun 2009
    Location
    Uberlndia, MG, Brazil
    Posts
    106

    Lightbulb Yet another approach

    Hi, guys,

    Would you mind taking a look at my own approach to the Ext.Direct / PHP integration?

    http://www.extjs.com/forum/showthread.php?t=95022
    Last edited by j.bruni; 25 Mar 2010 at 3:02 AM. Reason: Created another thread for the subject

  3. #23

    Question Real Basic Example needed

    Hi,
    I'm relatively new to Extjs, but am getting on OK, until I hit Direct. I'm writting an app with a lot of server-side code, so I thought I'd do it right from the beginning with this interface.

    Here's the code I've got in a basic test page, stripped to the minimum. I've used the download from this thread with no other changes except to move the sessions_start to my parent page, rather than within the api.php page, as I'll need it in the parent for my real application:

    Code:
    <?
    session_start();
    ?>
    <html>
    <head>
        <title>Ext.Direct Test</title>
     <link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css"/>
     <script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
     <script type="text/javascript" src="ext/ext-all-debug.js"></script>
     <script type="text/javascript" src="api.php"></script>
     
     <script type="text/javascript">
            Ext.onReady(function() {
       Ext.BLANK_IMAGE_URL = 'images/s.gif';
     
       // Test the direct setup
       var rv = Ext.ss.Echo.send('hello, world'); 
                alert ("Direct response: " + rv);
     
      });
        </script>
     
    </head>
    <body>
    Done
    </body>
    </html>
    I'm getting the error:"Ext.ss.echo is null or not an object" on line 14

    Can anyone point me in the right direction please?

    Regards,
    Andy

  4. #24

    Default

    My question may be silly.
    Please help me out of this issue.
    I am using a form with direct api and trying to insert records in to the db. But form values are not submitting to the server side.
    My Code:
    formadd= new Ext.form.FormPanel({
    // configs for FormPanel
    title: Add record,
    border: false,
    padding: 10,
    buttons:[{
    text: 'Submit',
    handler: function(){
    formadd.getForm().submit({
    params: {
    foo: 'bar',
    uid: 34
    }
    });
    }
    }],
    defaultType: textfield,
    items: [{
    fieldLabel: 'Name',
    name: 'name'
    },{
    fieldLabel: 'Email',
    msgTarget: 'side',
    name: 'logo_url'
    }],
    api: {
    // The server-side method to call for load() requests
    load: Vendor.read,
    // The server-side must mark the submit handler as a formHandler
    submit: Vendor.save
    },
    // specify the order for the passed params
    paramOrder: ['uid', 'foo']
    });
    Please help me soonnnnnnnnnnnn!!!!!!!

  5. #25

    Default

    Please help me from this issue ANYONE. SOON

  6. #26

    Default

    Try the following amendment:

    Code:
    api: {
    // The server-side method to call for load() requests
    load: Ext.php.Vendor.read,
    // The server-side must mark the submit handler as a formHandler
    submit: Ext.php.Vendor.save
    },
    This assumes you've included the ExtDirect API with a line something like the following:

    Code:
    <script type="text/javascript" src="classes/Vendor.php?javascript"></script>
    Hope that helps,
    Andy

  7. #27

    Default

    Oops. Just realised that I thought this was the thread at
    http://www.sencha.com/forum/showthre...ation-with-PHP

    The answer I've given only applies (I'm sure) if you're using the PHP classes mentioned in that thread (which I recommend, as they are re-vamped version of the classes in this thread).

    Regards,
    Andy

  8. #28

    Default Please help

    Its shows the following error Error: Ext.php is undefined

  9. #29

    Default

    ---------------------------------

    I am using codeigniter for server side and implementing Direct on a PHP server stack.

    Listed all the db table records in a grid using endpoint Vendor. Using like this


    stud.data.vendors = new Clutch.data.DirectStore({

    endpoint: Vendor,
    // autoLoad: False,
    fields: [
    { name: 'id' },
    { name: 'name', type: 'string' }
    ]
    })

  10. #30

    Default

    Clutch.data.DirectStore = Ext.extend(Ext.data.DirectStore, {
    constructor: function(config) {
    config = Ext.apply({
    root: 'records',
    autoLoad: true,
    autoSave: true,
    remoteSort: true,
    batch: false,
    writer: new Ext.data.JsonWriter({
    encode: false,
    writeAllFields: true
    })
    }, config);

    if (config.endpoint && !config.directFn) {
    config.api = {
    read : config.endpoint.read,
    create : config.endpoint.save,
    update : config.endpoint.save,
    destroy : config.endpoint.destroy
    }
    }
    Clutch.data.DirectStore.superclass.constructor.call(this, config);
    }
    });

Page 3 of 4 FirstFirst 1234 LastLast

Posting Permissions

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