-
1 Sep 2009 1:05 AM #1
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:
2. Add provider:Code:<script type="text/javascript" src="<?=base_path()?>direct/api"></script>
3. Now you can call some method, for example Time.get():Code:Ext.Direct.addProvider(Ext.app.REMOTING_API);
Now you can use your own classes:Code:Ext.mits.Time.get(function(provider, response) { Ext.Msg.alert('response', response.result); });
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:
If you use method to submit form, add @formHandler attribute:Code:class Time { /** * @remotable */ public function get(){ return date('m-d-Y H:i:s'); } }
Just see example classes, included in this implementation.Code:/** * @remotable * @formHandler */
To include your own classes replace $api definition in file direct.php with your own:
Classes files should be named accordingly MyClass1.php, MyClass2.php, ...Code:$api->add( array( 'MyClass1', 'MyClass2', ... ) );
If you want to use CodeIgniter object in your classes, just get instance:
P.S. This code doesn't work on Windows platform, because of backslashes in win paths.. something should be updated...PHP Code:$CI =& get_instance();
-
6 Nov 2009 3:17 AM #2
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.

-
6 Nov 2009 3:23 AM #3
-
6 Nov 2009 5:04 AM #4
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 Nov 2009 5:12 AM #5
-
6 Nov 2009 5:18 AM #6
ahahaha! ok.. anyway, nice library buddy.. thanks.. saves me some time..
-
24 Feb 2010 8:18 AM #7
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.
-
24 Feb 2010 10:18 AM #8
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.
-
25 Feb 2010 12:52 AM #9
-
25 Feb 2010 12:58 AM #10
in your direct controller, it should be:
Code:$this->extdapi->add( array( 'Echo' => array('prefix' => 'Class_'), 'Exception' => array('prefix' => 'Class_') ) );


Reply With Quote