Hi All

I have installed services and very happy the way it works. I am a flash developer and currently building a directory service in flash. I have setup views, cck + imagefieldcck. in my view i have created a list of nodes by type and their imagefields. the view displays all ok and I can see the path to the image field. the problem I have is if I display the same view in services views.get I dont get a proper path as shown below.

Array
(
    [0] => stdClass Object
        (
            [nid] => 17
            [node_revisions_body] => 
            [node_revisions_format] => 1
            [node_title] => Upgrade Account
            [node_data_field_module_image_field_module_image_fid] => 2
            [node_data_field_module_image_field_module_image_list] => 1
            [node_data_field_module_image_field_module_image_data] => a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}
            [node_type] => account_management_module
            [node_vid] => 17
        )

    [1] => stdClass Object
        (
            [nid] => 3
            [node_revisions_body] => Tooltip text to go here
            [node_revisions_format] => 1
            [node_title] => Add / Edit Plops
            [node_data_field_module_image_field_module_image_fid] => 1
            [node_data_field_module_image_field_module_image_list] => 1
            [node_data_field_module_image_field_module_image_data] => a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}
            [node_type] => account_management_module
            [node_vid] => 3
        )

)

in the views interface under preview I get the following all ok

Upgrade Account
Module Image: sites/default/files/accMgtImages/alien_0.png
Tooltip text to go here

Add / Edit Plops
Module Image: sites/default/files/accMgtImages/alien.png

also if I test services node.get the imagefield comes back ok. just not under views.get.

Does anybody have any ideas or seen this before?

Regards
Barry

CommentFileSizeAuthor
#5 drupalFlash.jpg161.63 KBbarrygearing
#4 viewsget.jpg279.86 KBsunchaser

Comments

sunchaser’s picture

same here

I can't even make a call to those CCK fields from within Flash ... all other (default) fields are ok

also , why on earth does the array element always start with "node_data_field_title" ???
the body_value field doens't have anything to do with the node_data_field_title as far as I'm concerned ...

[node_data_field_title_field_image_fid] => 15
[node_data_field_title_field_image_list] => 1
[node_data_field_title_field_image_data] => a:3:{s:11:"description";s:11:"abovebeyond";s:3:"alt";s:18:"frontpage newsitem";s:5:"title";s:18:"frontpage newsitem";}
[node_data_field_title_field_body_value] => With more than 6,3 million views, the official music video of Armin’s team-up with Sharon den Adel on ‘In & Out of Love’ is the most viewed Dutch video alltime on Youtube.
[node_data_field_title_field_body_format] => 1

carlosg2’s picture

Fist of all... on the drupal side:
Change the view settings to Row style: Node. (not Fields)
And add a relationship for the imagefield.

And on the flash side call views.get with an array of fields

views.get('viewname', ['nid','title','type','field_module_image' ])

Image field result example:

            [field_module_image] => Array
                (
                    [0] => Array
                        (
                            [fid] => 82
                            [list] => 1
                            [data] => Array
                                (
                                    [alt] => Tum in eu loquor. 
                                    [title] => Secundum vulputate enim inhibeo. Saluto ibidem persto facilisi eum premo ad lucidus paulatim. 
                                )

                            [uid] => 1
                            [filename] => filefield_xEI6le_3.png
                            [filepath] => sites/default/files/imagenes/filefield_xEI6le_3.png
                            [filemime] => image/png
                            [filesize] => 1973
                            [status] => 1
                            [timestamp] => 1252495270
                        )

                )
        )

Keep flashing with drupal
Regards

barrygearing’s picture

Awesome work ;)

Thank you so much, That works perfectly. I will show my flash drupal site when its done and all the do's and dont's.

sunchaser’s picture

StatusFileSize
new279.86 KB

still get an undefined from the trace in my actionscript
check attachment for my entire overview
I need help BAD ! :)

barrygearing’s picture

StatusFileSize
new161.63 KB

Hi Sunchaser

I see in your image you didn't change the relationship to one of your required fields. I have attached how I did my cck image field and what I now get in views.get.

Let me know what you get once you've done that and what you trace in flash.

Cheers
Barry

sunchaser’s picture

that's awesome Barry, thanx so much for taking the time to get me out of this mess ...
followed your screenshot but when I want to add relationships it only shows 1 of my CCK fields , namely the Noderef - one ... :(

I can't add my other fields (like the maintitle, subtitle or header).

Am I supposed to be able to add all the CCK fields that I want to call in my Flash right there in the relationship box ?

sunchaser’s picture

Barry !

alot of sweat and tears later ... I GOT IT UP AND RUNNING !

Thought I had the most recent module release for the views service ... but when I applied the patch from here http://drupal.org/files/issues/views-service.patch I got to see the fields when I do a views.get !!!
and I can now reach all my CCK fields without any problem.

what the patch does is : when you set your View to ROW STYLE : NODE in stead of Style : fields , it renders out the views.get as Node.get ... so with all the fields available for useage in FLASH...
if anyone else runs into this issue and needs some help, let me know through my contact form ... I want to payback for what Barry and others have done for me.

man , I just love open source !
Sunchaser

carlosg2’s picture

@barrygearing

Cool!

Your natural step forward is to use imagecache... For this you can test my proof of concept imagecache module. Look at http://groups.drupal.org/node/21248

Remember to clear your cache after enable the module. (in next versions you will not need to do this)

Looking forward to see your app...
Regards

klamoureux’s picture

Hey there,

I have been using this successfully for grabbing nodes and views, however, i recently upgraded to 6.14 of core and one particular view.get gives me an error when trying to connect:

Invalid argument supplied for foreach()
AMFPHP_RUNTIME_ERROR
/sites/all/modules/services/services.module on line 608

Things i have tried:
- I added the Relationship reference and now have the View returning filepath information that was not there before (thanks for above!)
- The View is returning a NODE, not fields, so unclear why it is looping through fields at all (this is line 608 of the services.module)

// Loop through and get only requested fields
  if (count($fields) > 0) {
    foreach ($fields as $field) {
      $val->{$field} = $node->{$field};
    }
  }
  else {
    $val = $node;
  }

Since i am not requesting any fields this should be skipped entirely.

I am passing an argument of a nodeId that is used to then return all the nodes that share that node reference.

View works and Services browser works when providing the same argument. THis was working before the core update!
Here is the AS3 call...

var viewArgArray:Array = new Array();
viewArgArray.push(nid.toString());
trace("passing view argument of " + viewArgArray.toString());
//Call Drupal to load the view
drupal.call( "views.get", viewResponse, sessionId, _viewName,"",viewArgArray);



Thoughts...

THis is my first post here of an issue, so i apologize if i have missed something ...

regards,

Kit

klamoureux’s picture

THought i would pass along an update

turns out that passing an empty string for the fields was the problem:
drupal.call( "views.get", viewResponse, sessionId, _viewName,"",viewArgArray);

when i changed simply created a new array and placed that in all was fine.

//Setup the responder with the callbacks
		var viewResponse:Responder = new Responder( onViewLoad, onError );
		var viewFieldsArray:Array = new Array();
		var viewArgArray:Array = new Array();
		viewArgArray.push(nid.toString());
		trace("passing view argument of " + viewArgArray.toString());
		//Call Drupal to load the view
		drupal.call( "views.get", viewResponse, sessionId, _viewName,viewFieldsArray,viewArgArray);

But thanks for being here and helping me work through the issue

Kit

barrygearing’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

delizade’s picture

big thanx for this issue. I was deep trouble and solwed it. thank you.

kurt.vs’s picture

Component: User interface » Code
Assigned: Unassigned » kurt.vs
Status: Closed (fixed) » Active

Hey Sunchaser,

I got the same problem: retrieving a view with a list of custom content types and a node reference in it. Everything
returns ok, except for the node reference, where I only get the Node Id, in stead of the title of that node.
I changed the row style already to 'node' and I put in a relationship for the Content: Node reference.

Does your patch still apply to the version of services_view 1.1.2.12?
And if so, where exactly in the php do I need to make a change? The function views_service_get looks very different.

Cheers,

Kurt

skyredwang’s picture

Status: Active » Closed (fixed)