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

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

Author Message

Björn [email protected]

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

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

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 [email protected]

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.

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/