Forums / Developer / how can i get data from object ?

how can i get data from object ?

Author Message

Selmah Maxim

Monday 19 May 2003 5:26:25 am

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 !

Tony Wood

Monday 19 May 2003 5:38:27 am

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.

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Selmah Maxim

Monday 19 May 2003 5:44:57 am

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

Tony Wood

Monday 19 May 2003 5:46:40 am

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

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Selmah Maxim

Monday 19 May 2003 5:47:40 am

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 ?

Selmah Maxim

Monday 19 May 2003 5:49:01 am

hmmm ..

u mean :

$pub = $node->create(attribute->("Published"));

?

Selmah Maxim

Monday 19 May 2003 5:53:01 am

i got another empty object :(

Tony Wood

Monday 19 May 2003 5:56:49 am

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

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Selmah Maxim

Monday 19 May 2003 5:57:54 am

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

Selmah Maxim

Monday 19 May 2003 6:28:04 am

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

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

Selmah Maxim

Monday 19 May 2003 6:49:11 am

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 !

Selmah Maxim

Monday 19 May 2003 7:28:03 am

is there better way ?

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

// 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") $Data[$Name] = $Value;
if("$Name" == "ClassID") $Data[$Name]= $Value;
if("$Name" == "Published") $Data[$Name] = $Value;
if("$Name" == "CurrentVersion") $Data[$Name] = $Value;
}

echo $Data[Published]+$selectedEnumValue;
echo "<br>";
echo strtotime("now");

____________________