-
9 Jul 2010 12:48 AM #21
Hi !
I think I've found what caused my problem and you where true, the echo wasn't the problem.
I don't know why (maybe a copy/paste error between two projects I'm working on), but after my "echo" there was a "die();"... now it explains all ;-)
Sorry to have taken your time away. Rest assured I will report anything (real) I'll found about your ExtDirect, because I'll use it extensively the next weeks in a project I'm starting right now.
Thanks a lot to have taken some time to help me, it definately gave me some advice on my problem !
-
9 Jul 2010 9:41 AM #22
New version - new features - coming soon!
New version - new features - coming soon!
No problem. In fact, I thank the opportunity to share here in the forums a bit more information about "ExtDirect.php" internals. Also, each post makes the thread stay on top of the latest updated!

I thought the cause of your problem could be also something related to the "header" command in ExtDirectController::output... but now you already found the real cause.
I am using this "ExtDirect.php" in a project I am developing right now. More features were recently added! So, soon I will upload a new version.
Basically, three new configuration options were added, all of callback type: "authorization_function", "transform_result_function", and "transform_response_function"
You will be able to specify an "authorization_function", where you can check the user permissions and return true or false accordingly, allowing the API call or not.
With the "transform_result_function", you can modify the result of the API method call after its execution, but before it is sent to the client-side.
Finally, with the "transform_response_function", you can modify the response structure. This allows to fire server-side events! But I am not using this feature for it. I am using it to send extra server side data together with the RPC result.
So... stay tuned!
CYO
-
12 Jul 2010 7:02 AM #23
Great job J! I just implemented this as a test last night, and like it's simplicity.
One question though (which may or may not be specific to your code): I'm planning on using ExtJS's polling functionality soon - is there any way to pass a direct function into a polling provider (a bit like directFn for data stores)?
Regards,
Andy
-
12 Jul 2010 1:43 PM #24
Nice job on this! My company has a good jump ahead on this from compared to what you have made but you are getting the clear picture.

Unfortunately I can't discuss in public what our company is doing, but if you need/want to chat about anything just shoot me a message.
Regards,
Ron
-
13 Jul 2010 8:12 AM #25
Hi all,
A word of advice:
This works:
This doesn't :-)Code:ExtDirect::$form_handlers = array( 'Config::setConfig'); ExtDirect::provide( 'Config' );
The latter method generates stack overflow errors when using multiple parameters, although it works fine with 1 parameter or 0 parameters, oddly.Code:ExtDirect::provide( 'Config' ); ExtDirect::$form_handlers = array( 'Config::setConfig');
Great work - I love the form handler shortcut of having parameters automatically defined via the $_POST parameter names. Very slick!
Andy
-
14 Jul 2010 5:58 AM #26
PROBLEM SOLVED: SEE ANSWER LATER IN THIS POST
Hi,
One question about form data: I'm using a checkbox which submits the value "on" if it is selected. However, if it's not selected, nothing gets submitted, and the direct function doesn't seem to run at all. Here's the function being called:
Firebird() is a self-written routine to dump the output to firePHP and a debug file as well. As it's the first line in the function, I would expect it to run, but it doesn't, which implies the function is not running.Code:public function setProxiesConfig($proxies_enabled="") { firebird("Proxies enabled = " . $proxies_enabled); $this->setOption("proxies_enabled", $proxies_enabled); $this->saveConfig(); $obj = array( 'success' => true ); return $obj; }
The JSON response was:
{"type":"rpc","tid":"12","action":"ConfigManager","method":"setCaptchaConfig","result":"Exception"}
But there was no PHP error generated that I can see anywhere (and I've got PHP writting errors to a single log file regardless of which PHP file was running).
Can anyone offer any inspiration to get round this?
Regards,
Andy
SOLUTION FOUND:
Enable the option to only count mandatory parameters:
Code:ExtDirect::$count_only_required_params = true;
Last edited by Andrew Peacock; 14 Jul 2010 at 1:30 PM. Reason: Problem solved
-
16 Jul 2010 3:37 AM #27
Hi,
Anyone got any thoughts on how to do this within a polled operation?
Andy
-
19 Jul 2010 7:49 AM #28
How to access the returned data?
How to access the returned data?
OK, it's been a long day, I'm just back off my hols, and I'm new to this kind of complex JS, so I can't work this one out.
I've got the extdirect code working absolutely fine. But I'm having problems accessing the returned data FROM OUTSIDE THE EXTDIRECT CALL...
Here's the relevant code:
Code:var plugins = ['plugin1', 'plugin2']; var input="Anyone there? " ; var hook='test'; function executeHook(hook, input) { var output = ""; Ext.php.PluginManager.executeHooks(plugins, hook, input, function(data) { console.info("DEBUG WITHIN FUNCTION: " + data); output = data; }); return output; } console.info("RESULT FROM FUNCTION:" + executeHook(hook, input));
Each plugin simply adds a piece of test to the input, in a chain. So the output should be:
"Anyone there? Hello from core; Hello from plugin 2; Hello from plugin 1; "
However, the console has the two output lines as follows:
"RESULT FROM FUNCTION:"
"DEBUG WITHIN FUNCTION: Anyone there? Hello from core; Hello from plugin 2; Hello from plugin 1; "
So the variable data is correct within the ExtDirect call, but how do I get access to the data outside the ExtDirect call?
I've also tried:
But that produces the same result.Code:Ext.php.PluginManager.executeHooks(plugins, hook, input, function(data) { console.info("DEBUG WITHIN FUNCTION: " + data); return data; });
Any ideas?
Regards,
Andy
-
19 Jul 2010 1:00 PM #29
@Andy
You must remember that the Ext.Direct calls are asynchronous which means you cannot count on the callback parameter being executed in a linear fashion like the rest of your function code. In your example the function executeHook() calls the Direct method which sets a callback, then it returns output, which is empty until the callback is called. Once the HTTP request initiated by the executeHooks() completes, it then calls your callback and sets the value of output but by then your initial function has returned. You will have to redesign your logic to handle this
-
19 Jul 2010 3:48 PM #30
Thanks Trii... I came to the same conclusion myself shortly afterwards. I typed that discovery into a post here, but I guess I forgot to press "submit". But thanks anyway - I appreciate your help.
Whilst you and I are here.... I don't suppose you've got any thoughts about how to use this integration in a polling process? I don't have a scooby where to start.
(Scooby => Scooby Doo => clue)
Regards,
Andy
Similar Threads
-
Ext.Direct PHP backend
By ckr in forum Ext.DirectReplies: 34Last Post: 11 Jun 2012, 1:30 PM -
Alternative Ext Direct PHP Implementation
By TommyMaintz in forum Ext.DirectReplies: 36Last Post: 26 Sep 2011, 12:08 AM -
Easy Ext.Direct integration with PHP
By j.bruni in forum Ext.DirectReplies: 2Last Post: 23 Jun 2010, 11:27 AM -
Simple Ext.Direct PHP apps
By pkristiana in forum Community DiscussionReplies: 1Last Post: 11 Feb 2010, 1:12 AM


Reply With Quote