subdomain woes

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Anonymous's picture

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?

  1. Where is the best place to locate a custom script that requires any of the 'include' files?
  2. 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?
  3. 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

HylkeVDS's picture

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

Anonymous's picture

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.

Anonymous's picture

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

HylkeVDS's picture

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 :)

Drupal in Education

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week