Forums / Developer / How to save from PHP all the fields of an eZURL attribute?
Massimiliano Bariola
Wednesday 02 November 2005 6:35:44 am
Hi, I am trying to correctly save the link title and link URL into an eZ object I build in my extension's PHP code.
So far, I have only been able to save the title part; I am unable to save the url.
For those who have access to it, I am basically using the same technique suggested on "learning Exponential 3" book, pages 137 - 138.
$linkAttributes=$attribs[$i]->Attributes(); //this gets saved $attribs[$i]->setAttribute('data_text', $tb_title); // I try to extract this to delve deeper into the contentobjectattribute's structure, but I think there must be an easier way .... $oa=$attribs[$i]->Attribute('object'); $odm=$oa->dataMap(); // some code should go here involving $odm's content, but I think there should be an esier way .... $attribs[$i]->store();
Björn X
Wednesday 02 November 2005 11:16:18 am
if ( is_array( $data) ) { //set data and text $contentObjectAttribute->setAttribute( 'data_text', $data['text'] ); $contentObjectAttribute->setContent( $data['url'] ); } else { $contentObjectAttribute->setContent( $data ); } $contentObjectAttribute->store();
I guess this helps...
Thursday 03 November 2005 3:27:17 am
Great! that's what I was trying to achieve. thank you.