Hybrid View

  1. #1
    Ext User
    Join Date
    Apr 2009
    Posts
    9
    Vote Rating
    0
    goachka is on a distinguished road

      0  

    Default Ext.Direct for CodeIgniter

    Ext.Direct for CodeIgniter


    Usage
    Just copy archive contents to your application folder.
    It will create cache folder in your application folder (make this folder writable!).
    It will place extdapi.php, extdcacheprovider.php, extdrouter.php to the libraries folder.
    It will place example classes Echo.php, Exception.php, File.php, Time.php to the same folder.
    And it will place direct.php to the controllers folder.

    Now you can test it:
    1. Add a script tag in your main application page for the API:
    Code:
    <script type="text/javascript" src="<?=base_path()?>direct/api"></script>
    2. Add provider:
    Code:
    Ext.Direct.addProvider(Ext.app.REMOTING_API);
    3. Now you can call some method, for example Time.get():
    Code:
    Ext.mits.Time.get(function(provider, response) {
        Ext.Msg.alert('response', response.result);
    });
    Now you can use your own classes:
    Place them to the libraries folder. Don't forget to make comments before each method of your class. First of all it should have @remotable attribute:
    Code:
    class Time {
        /**
         * @remotable
         */
        public function get(){
            return date('m-d-Y H:i:s');
        }
    }
    If you use method to submit form, add @formHandler attribute:
    Code:
    /**
     * @remotable
     * @formHandler
     */
    Just see example classes, included in this implementation.

    To include your own classes replace $api definition in file direct.php with your own:
    Code:
    $api->add(
        array(
            'MyClass1',
            'MyClass2',
            ...
        )
    );
    Classes files should be named accordingly MyClass1.php, MyClass2.php, ...

    If you want to use CodeIgniter object in your classes, just get instance:
    PHP Code:
    $CI =& get_instance(); 
    P.S. This code doesn't work on Windows platform, because of backslashes in win paths.. something should be updated...
    Attached Files

  2. #2
    Sencha User khebs@live.com's Avatar
    Join Date
    Mar 2008
    Posts
    83
    Vote Rating
    0
    khebs@live.com is on a distinguished road

      0  

    Default


    hi goachka, thanks for this dude, but, just would like to ask if, does this contribute to any performance using Ext.Direct Techniques? and when do we need to use Ext.Direct approach? hope you could make some time buddy... reply much appreciated.

  3. #3
    Ext User
    Join Date
    Apr 2009
    Posts
    9
    Vote Rating
    0
    goachka is on a distinguished road

      0  

    Default


    You want to know what is Ext.Direct?

    Quote Originally Posted by khebs@live.com View Post
    hi goachka, thanks for this dude, but, just would like to ask if, does this contribute to any performance using Ext.Direct Techniques? and when do we need to use Ext.Direct approach? hope you could make some time buddy... reply much appreciated.

  4. #4
    Sencha User khebs@live.com's Avatar
    Join Date
    Mar 2008
    Posts
    83
    Vote Rating
    0
    khebs@live.com is on a distinguished road

      0  

    Default


    No no.. hmm, im using CodeIgniter too, but i'm using the standard approach, by using Ext.Direct in your point of views, does it contribute to any performance? and when will it be; for a developer to choose Ext.Direct for his/her backend?

  5. #5
    Ext User
    Join Date
    Apr 2009
    Posts
    9
    Vote Rating
    0
    goachka is on a distinguished road

      0  

    Default


    it's just the same
    i've just made it as CodeIgniter library to load like $this->load->library(...);

    Quote Originally Posted by khebs@live.com View Post
    No no.. hmm, im using CodeIgniter too, but i'm using the standard approach, by using Ext.Direct in your point of views, does it contribute to any performance? and when will it be; for a developer to choose Ext.Direct for his/her backend?

  6. #6
    Sencha User khebs@live.com's Avatar
    Join Date
    Mar 2008
    Posts
    83
    Vote Rating
    0
    khebs@live.com is on a distinguished road

      0  

    Default


    ahahaha! ok.. anyway, nice library buddy.. thanks.. saves me some time..

  7. #7
    Sencha User
    Join Date
    Aug 2007
    Posts
    44
    Vote Rating
    0
    cherbert is on a distinguished road

      0  

    Default


    I am a bit confused as I have never used Libraries before. I generally use the Model, View, Controller featrues.

    Can you provide me a quick real world example of how for instance you would use CI's normal Database function to create a select query and then send the json result? Would I need to ditch using Models for this and start creating separate classes in the Library folder?

    Just a nudge would help to so I can get my head round how things should be structured.

  8. #8
    Sencha User
    Join Date
    Aug 2007
    Posts
    44
    Vote Rating
    0
    cherbert is on a distinguished road

      0  

    Default


    Well I can't get this working at all. In Ext I'm getting 'provider is undefined'.

    To troubleshoot I pointed my browser at the direct controller mysite/direct/api and I am getting the following PHP Notice.

    Undefined variable: api

    I have everything installed as per the instructions. libs all in the libraries folder and direct.php in the controller folder. I have created the cache folder and it is writable.

  9. #9
    Ext User
    Join Date
    Apr 2009
    Posts
    9
    Vote Rating
    0
    goachka is on a distinguished road

      0  

    Default


    Quote Originally Posted by cherbert View Post
    Well I can't get this working at all. In Ext I'm getting 'provider is undefined'.

    To troubleshoot I pointed my browser at the direct controller mysite/direct/api and I am getting the following PHP Notice.

    Undefined variable: api

    I have everything installed as per the instructions. libs all in the libraries folder and direct.php in the controller folder. I have created the cache folder and it is writable.
    hmm.... Undefined variable: api - which file? which line?

  10. #10
    Sencha User khebs@live.com's Avatar
    Join Date
    Mar 2008
    Posts
    83
    Vote Rating
    0
    khebs@live.com is on a distinguished road

      0  

    Default


    in your direct controller, it should be:

    Code:
    $this->extdapi->add(
      array(
        'Echo' => array('prefix' => 'Class_'),
        'Exception' => array('prefix' => 'Class_')
      )
    );

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar