[SOLVED] How can you display all the field elements unserialized

More
2 years 8 months ago - 2 years 8 months ago #58165 by iamrobert
Hi,

I am trying to output a complete list of all the values in a checkbox from the field- not for each individual item - but for all the values.

My field name is "World Regions"
"field_elements":"region_01::North America%% region_02::South America%% region_03::Europe%% region_04::Middle East%% region_05::Africa%%"

The code I want is:
<input type="checkbox" value=".region_01" id="region_01"><label for="region_01">North America</label> 
<input type="checkbox" value=".region_02" id="region_02"><label for="region_02">South America</label>
etc... for all the World Regions

The word "region_01" is the field value, The word "North America" is the label.

I have tried doing this in a category but it fails. ( www.flexicontent.org/documentation/faq/6...to-work-in-v156.html )

Any Ideas?
Last edit: 2 years 8 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #58167 by micker
you want the config of field not value ...

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #58172 by iamrobert
Hi Micker,

How do I call "config of field"?

I have spent a day on this - but can't find an answer.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #58174 by micker
Need georgios

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago - 2 years 8 months ago #58204 by ggppdk
$fieldname = 'the_NAME_of_the_field';

if ( !isset($item->fields[$fieldname]->parameters) ) {
	FlexicontentFields::loadFieldConfig($item->fields[$fieldname], $item);
}
$extra_props = array();  // use  $extra_props = array('image');   // if radioimage or checkboximage field
$elements = FlexicontentFields::indexedField_getElements( $item->fields[$fieldname], $item, $extra_props );


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 2 years 8 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago - 2 years 8 months ago #58233 by iamrobert
Thanks so much and its super.

Here's my code that I can put into category_items:
<?php for ($i=$leadnum; $i == 1; $i++) : $item = $items[$i]; ?>
<?php $fieldname = 'the_NAME_of_the_field';

if ( !isset($item->fields[$fieldname]->parameters) ) {
	FlexicontentFields::loadFieldConfig($item->fields[$fieldname], $item);
}
$extra_props = array();  // use  $extra_props = array('image');   // if radioimage or checkboximage field
$elements = FlexicontentFields::indexedField_getElements( $item->fields[$fieldname], $item, $extra_props );

if (!empty($elements)) foreach ($elements as $el) {
	if ( @unserialize($el)!== false || $el=== 'b:0;' ) $el = unserialize($el);
	
//var_dump($el);

// CALL STD OBJECTS
echo $el->value;
echo $el->text;
}
?>
<?php endfor; ?>
Last edit: 2 years 8 months ago by iamrobert.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.