Forums / Developer / returning ez data in array

returning ez data in array

Author Message

Matt Gifford

Monday 15 September 2008 2:44:55 am

Hi all

I'm using FLEX to create a flash version of my site, and until now have been returning the data using amfphp and generated functions that I have written by directly accessing the database.

I'm now working on creating an extension, taking URL params, that will return the content I need using ezPublish's built in fetch function, and the ezini function.

Is it possible to return the data as an array to send to my Flex application?

For example, I have the amfphp running in the flashservices directory
(root/flashservices/services/classFile.php)

my extension, currently displaying the results within a template, is here:

(root/extension/amfphp/modules/amfphp/callback.php)

Can ezPublish return data as an array only, which I can passback to my classFile.php in another directory?

Many thanks,

Matt

André R.

Monday 15 September 2008 3:42:05 am

What "ez data"?

node and object information can be returned by the eZContentObjectTreeNode::subTreeByNodeId function as array with the AsObject = false parameter.
Many fetch functions have a similar parameter to return raw mysql data instead of objects.

But you won't get the data of the attributes this way directly.

Either you can take a look at the code in ezcore (classes/ezajaxcontent.php::simplify):
http://projects.ez.no/ezcore

Or write something specific using eZContentObjectTreeNode::subTreeByNodeId + eZContentObjectAttribute::fetch with the AsObject parameters set to false.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Matt Gifford

Monday 15 September 2008 5:01:53 am

Hi Andre

thank you very much for your help.
Sorry, when I said ez Data, I just meant data returned from the CMS. My fault.

I have the eZContentObjectTreeNode::subTreeByNodeId method returning the array to the ezPublish extension template page.

My plan was to send params to the module page within the url, and generate the array, which with your help I am now doing.

My main question now is is it possible to return purely the array to my calling page?

I was hooping to call the url, eg.

http://roottoEZPub/amfphp/callback/methodName/getrootnode/

from within the flashServices directory, hopefully through an HTTP call or something?
I currently have a template showing the data for my module/extension, but can I have purely the array returned?

Many thanks

André R.

Monday 15 September 2008 5:08:33 am

I'm not sure what your asking for, I have never used amfphp or Flash, so if you can keep the question to a eZ Publish scope I / someone else might be able to help you.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Matt Gifford

Monday 15 September 2008 5:33:11 am

Thanks Andre.

I appreciate I'm going a little off topic, but I really just want to know if I can retrieve/obtain an ezPublish array (which I am now getting thanks to your help) without using an ezPublish template to display it in, as I want to use the data on a different part of the site.

Many thanks

André R.

Monday 15 September 2008 9:22:02 am

I'll guess you are talking about not using pagelayout, just output stuff directly?

If so end your callback view with echo'ing out the data and:

eZDB::checkTransactionCounter();
eZExecution::cleanExit();

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Matt Gifford

Tuesday 16 September 2008 2:08:46 am

Hi Andre

thank you for your continued help.

I currently have an extension, and the output is being written to a template within the extension/design folder, so I'm not using a pagelayout.tpl file specifically for the extension.

Where shoudl I place the eZExecution::cleanExit code?
Within the templateoperator file? The module file, or the callback.php file?

Many thanks,

Matt

André R.

Tuesday 16 September 2008 3:26:41 am

Once again I have no Idea what you want to use, I thought you wanted to avoid using pagelayout in the last post, so I suggested to put the above code in the end of callback.php

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom