Posted by Anonymous on October 6, 2009 at 4:06pm
I recently wrote a custom php script to catch a grade from Flash (Actionscript2) and pass it to the gradebook. It works fine on my test installation, but when I tried to move it to a subdomain of my production site, I'm getting a failure message from line 1009 of bootstrap.inc. Seems that bootstrap.inc can not find the other include files.
I'm actually thinking that calling a bootstrapped php script from Flash might not be the best way to invoke the gradebook module functions, but I don't know what else to try, and it was working when I run it within a single site installation. Does anyone know the answer to any of the following questions?
- Where is the best place to locate a custom script that requires any of the 'include' files?
- If I put a script at the drupal installation root, but call it from within a subdomain site, what do I have to do to tell the script which db I'm targeting?
- Is there an easier way to call a module function from Flash? From javascript? I'm stuck with AS2, so I'm not using services. Seems that there IS an AS2 implementation of Flash Remoting, but lately I haven't been able to find any documentation for it, so I'm doing this the old fashioned way.
Becky
Comments
Take a look at how arcade does it
Maybe you could take a look at how the arcade module (http://drupal.org/project/arcade) handles the posting of scores from flash to drupal? You should be able to use the same code, but instead of writing a score to a highscore table you write a grade to the gradebook.
Hylke
that did it
Hylke,
Thanks for the lead. The solution turned out to be this brilliant snippet from the Arcade module that solved my bootstrapping problems:
if (!function_exists('drupal_get_path')) {
$prefix = "";
while(!file_exists($prefix ."includes/bootstrap.inc")) {
$prefix .= "../";
}
if ($prefix != "") chdir($prefix);
include_once("./includes/bootstrap.inc");
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
chdir(drupal_get_path('module','to_gradebook'));
This is much better.
Actually, that arcade thing ultimately failed me, and besides I've figured out the answer to my original question: how to call a module function from flash. I've blogged about it at http://drupal.flash4ed.com/node/3.
Nice piece. Since you send
Nice piece.
Since you send your data in the url and not in a POST, you might run into url-length-problems, depending on what you're sending.
http://www.boutell.com/newfaq/misc/urllength.html
It's not likely to happen if you're only sending scores, but when users can write longer bits of text you always have some students that send in pages of prose :)