This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » how can i get data from object ?
expandshrink

how can i get data from object ?

how can i get data from object ?

Monday 19 May 2003 2:26:25 pm - 11 replies

Hi,

How can i get the data from object ?

$node =& eZContentObjectTreeNode::fetch( $parameters['node_id'] );

i get object with what i need, but how to view it, let say i wanna get just 1 value from this object !

Monday 19 May 2003 2:38:27 pm

Try these:
{$node.data_map|attribute(show, 1)}
{$node.object|attribute(show, 1)}

Attribute show can be used on any variable and is really handy when tracking down template issues.

Monday 19 May 2003 2:44:57 pm

not with template lang, i need it from php file !

Monday 19 May 2003 2:46:40 pm

to do this create an operator and then pass the values back to the template to see them...

Monday 19 May 2003 2:47:40 pm

this the object with print_r :

ezcontentobject Object
(
[PersistentDataDirty] =>
[ID] => 81
[Name] => My Test
[CurrentLanguage] => eng-GB
[ClassName] => Test Data
[DataMap] => Array
(
)

[ContentActionList] =>
[ContentObjectAttributes] => Array
(
)

[SectionID] => 3
[OwnerID] => 14
[ClassID] => 7
[IsPublished] => 0
[Published] => 1052936394
[Modified] => 1052987482
[CurrentVersion] => 4
[Status] => 1
[RemoteID] =>
[Permissions] => Array
(
)

)
___________
now how can i get the Published value alone ?

Monday 19 May 2003 2:49:01 pm

hmmm ..

u mean :

$pub = $node->create(attribute->("Published"blunk.gif Emoticon);

?

Monday 19 May 2003 2:53:01 pm

i got another empty object sad.gif Emoticon

Monday 19 May 2003 2:56:49 pm

http://ez.no/sdk/ezutils has details on the API and eZRSS in contributed items has an example of use.

Monday 19 May 2003 2:57:54 pm

ok, thx i`ll check it if not i`ll post back here !

Monday 19 May 2003 3:28:04 pm

didn`t help ,,, i didn`t find what i need !

the data is there, but how to access it ?!

Monday 19 May 2003 3:49:11 pm

Tony ..

i don`t need to pass anything to the template (for now), all what i need to get the data from the object.

am trying to make new workflow, checking the published date and the enum value, the enum value is timestamp, and is published+enumvalue>= current_date, then the data will be unactive ... easy idea to do it alone with simple php, but it`s look complex in ez32 !

Monday 19 May 2003 4:28:03 pm

is there better way ?

_________
$node =& eZContentObjectTreeNode::fetch( $parameters['node_id'] );
$data_map = $node->attribute("data_map"blunk.gif Emoticon;
$Object = $node->attribute("object"blunk.gif Emoticon;

// enum value
$enumAttribute = $data_map[ 'registeration_period' ];
$enumObj = $enumAttribute->attribute( 'content' );
$enumobjectList = $enumObj->attribute( 'enumobject_list' );
$selectedEnumValue = $enumobjectList[0]->attribute( 'enumvalue' );

//
foreach ($Object as $Name=>$Value)
{
if("$Name" == "ID"blunk.gif Emoticon $Data[$Name] = $Value;
if("$Name" == "ClassID"blunk.gif Emoticon $Data[$Name]= $Value;
if("$Name" == "Published"blunk.gif Emoticon $Data[$Name] = $Value;
if("$Name" == "CurrentVersion"blunk.gif Emoticon $Data[$Name] = $Value;
}

echo $Data[Published]+$selectedEnumValue;
echo "<br>";
echo strtotime("now"blunk.gif Emoticon;

____________________

Modified on Monday 19 May 2003 4:29:47 pm by Selmah Maxim

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from