Have been playing around with the module for a while and it is a brilliant contribution. Drupal becomes a powerful backend to flash.

However we are struggling a bit with Views and arguments. Calling views are fine until we add an argument for it in Drupal. Then no result is returned on the remoting call.

In the Flash remoting NetConnection Debugger the last thing we get is:

DebugId: "0"
EventType: "Call"
MethodName: "Views.getView"
MovieUrl: "file:///D|/xampp/workspace/Spacelab_flash/spacelab.swf"
Protocol: "http"
Source: "Client"
Time: 1157627721828
Date (object #1)
....."Thu Sep 7 12:15:21 GMT+0100 2006"
Parameters (object #2)
.....[0]: "myView"
.....[1] (object #3)
..........[0]: "title"
..........[2]: "nid"
.....[2] (object #4)
..........[0]: "Work"

0 being name of view
1 the fields we want
2 the argument for views

Everything is fine until we add an argument in Drupal. If enabling a page for the view the work argument forks fine and we get the nodes back. Have no other problems using the module, nodes, taxonomy and even our own cutom services.

Question: Have you succesfully used the amfphp views service with arguments? Any ideas where to start looking?
(Am ok with the actionscript but still so and so with the php)

cheers

CommentFileSizeAuthor
#5 Node.as2.08 KBpetterw

Comments

petterw’s picture

This is documented in the readme file:

- Services execute inside of /services directory rather than at Drupal root.
This causes problems when using certain Drupal functions, and module functions.

The specific problem in views is with the drupal_get_path function in the views_build_view function.

How to fix it goes beyond me. I can see it being a bad idea to put some code in views.module. So how do you do it?

snelson’s picture

Hi,

Glad to see someone trying it out. I actually had to hack one line of Views.module in order to get this to work for me. Obviously this is not a good fix, but neccessary until we can figure out how to get AMFPHP to execute in the root.

This is what I did in views.module views_build_view()

changed: require_once("./$path/views_query.inc");
to: require_once($_SERVER['DOCUMENT_ROOT'] . "/$path/views_query.inc");

Again, this is not a problem with views.module, it is a problem with AMFPHP executing in the services directory. Currently searching for a solution. Ideas and patches appreciated.

snelson’s picture

The culprit seems to be at line 104 of amf-core/app/Actions.php

// change to the gateway.php script directory
// now change to the directory of the classpath.  Possible relative to gateway.php
$dirname = dirname($amfbody->classPath); 
if(is_dir($dirname))
{
  chdir($dirname);
}
chromamix’s picture

Could either of you provide your actionscript as a sample? Being new to Drupal and fairly new to remoting, I could use the boost. I've been looking into Drupal specifically to be a backend to Flash, and I'm excited to see this AMFPHP module emerging. Thanks much.

petterw’s picture

StatusFileSize
new2.08 KB

Did a similar less elegant hack in views.module. Had similar problems with the date module as well.

Have played around with the code put can't up with a working solution if the amfphp services are to sit in the amfphp module folder.

And to chromamix, best thing is to read through the HelloWorld example on the amfphp site and then try and understand Scott's amfphp drupal module services and how they pull the data out. I have attached a basic node as class that I then extend depending on what type of content I need.

chromamix’s picture

Thanks for your reply, kenandi.

What should my complete gatewayUrl be? My drupal install is at the root of my domain, and I've installed amfphp in sites/default/modules. The HelloWorld example shows a complete path to the gateway.php file, but it looks like gatewayURL in your Node.as file would be something like http://www.mydomain.com/amfphp, without gateway.php in the path.

gatewayUrl = drupalUrl + "amfphp";

I'm guessing that drupalURL = http://www.mydomain.com/. Perhaps this drupalURL is where I've gone wrong.

I greatly appreciate your help.

Bengel-1’s picture

your gateway url would be something like http://www.mydomain.com/q=amfphp .

Bengel

Bengel-1’s picture

oh. and one other thing which took me a while to get was the service folder has to be next to the amfphp install folder and not in it! Readme in the module installer has the right information, but it was a bit confusing to me at first. Further on gateway.php is not used but instead gateway.inc is called by drupal. Related to this is the fact that the AMFPHP service browser can't be called directly as the link to drupal is missing then. Please correct me if I'm wrong on this, I'm fairly new to drupal myself.

Bengel

merlinofchaos’s picture

maybe the module needs to do this:

set_include_path(get_include_path() . PATH_SEPARATOR . $path);

Where $path is the drupal installation directory.

snelson’s picture

Status: Active » Fixed

While this issue may still stand in the 4.7 version of amfphp module, it is no longer an issue with 5.x, and 4.7 is not supported.

Anonymous’s picture

Status: Fixed » Closed (fixed)