PHP fetch the options stored in an class attribute

Author Message

Felix Laate

Wednesday 22 March 2006 6:24:11 am

Hi all,

another php-related question for you all:

In an event, I need to fetch the options stored in an class attribute (of type ezSelection). I've fooled around with the <i>eZContentClassAttribute</i> class, doing something like this:

$classAtrribute =& eZContentClassAttribute::fetch(278);
$caContent =& $classAtrribute->content();
$caOptions =& $caContent['options'];

But it will not work.

Any help is helpful!

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Kristof Coomans

Wednesday 22 March 2006 9:31:36 am

Hi Felix

Did you fetch the right class attribute? Inspect it with

var_dump( $classAttribute );

If it's the right class attribute, take a look at it's content with

var_dump( $caContent );

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Betsy Gamrat

Wednesday 22 March 2006 10:30:15 am

eZ selections are stored as integers in data_int

$attribs =& $iObject->contentObjectAttributes();
	for($i=0;$i<count($attribs);$i++){
		switch($attribs[$i]->attribute("contentclass_attribute_identifier")) {
			case 'a':
	 			$attribs[$i]->setAttribute('data_int', $a );
	 			$attribs[$i]->store();
			break;
			case 'b':
				$attribs[$i]->setAttribute('data_int',$b);
				$attribs[$i]->store();
		}
	}

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.