Forums / Developer / HOWTO? Use eZContentobjectAttribute::setContent() on a simple text datatype

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

HOWTO? Use eZContentobjectAttribute::setContent() on a simple text datatype

Author Message

Björn X

Wednesday 04 August 2004 5:27:40 am

Current code I use.....

        $data_map =& $contentObject->attribute("data_map");
        $data_map['name']->setAttribute( 'data_text', 'Monthly Service' );
        $data_map['name']->store();

But know I would like to use setContent.... Somhow the code does not work

How do I use it?

        $content = 'Monthly Service';
        $data_map =& $contentObject->attribute("data_map");
        $data_map['name']->setContent( $content );
        $data_map['name']->store();

 

thx for your suggestions

Jan Borsodi

Thursday 05 August 2004 1:36:40 am

The <i>setContent()</i> wasn't created for this behaviour actually, some datatypes do this but only internally.

Hower to remedy the problem with inserting data uniformly some new additions are being made to the eZDatatype interface.

Currently these are added:
<i>insertHTTPFile</i> - Insert an uploaded file (HTTP Post)
<i>insertRegularFile</i> - Insert a local file
<i>insertSimpleString</i> - Insert a simple string

It is also possible to query if a datatype supports any of these insert methods.

But this will only help if you are using 3.5.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Björn X

Thursday 05 August 2004 2:53:23 am

Thx amos,
for this info.

I will test/use those methods when I need them the next time.