FLEXIcontent Field Group Accordion

More
8 years 7 months ago - 8 years 7 months ago #56822 by iamrobert
Hi,

I'm really impressed with field groups and customized html, and I know its under development.

www.flexicontent.org/documentation/faq/7...of-other-fields.html

In the code plugin there is $n which sets the item number for each value. 1, 2, 3

Is there anyway to add this value to an item_field. So item_field1, item_field2 etc for each item in the field group?

The reason is I think this could do an accordion - as the code requires a unique id:
Bootstrap: getbootstrap.com/2.3.2/javascript.html#collapse
Foundation: foundation.zurb.com/docs/components/accordion.html

I suppose I can do it with js.

Thanks,

Robert
Last edit: 8 years 7 months ago by iamrobert.

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

More
8 years 7 months ago #56824 by ggppdk
Hello

-- you speak of replacements in:

- Open Field text
- Prefix Value Text
- Suffix Value Text
- Close Field text

the item number is usuable in fieldgroup too
{{fieldname##nn}}
{{fieldname##nn##propertyname}}

nn: 3 is the value of the field in the 3rd group of the fieldgroup


-- 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...

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

More
8 years 7 months ago #56826 by ggppdk
But if you want to use these in some custom display

you need this FAQ article:

Using the raw value of a field inside a template file or inside a new custom field type


-- 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...

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

More
8 years 7 months ago #56830 by iamrobert
Thanks ggppdk,

I'm a little closer. Now - I have two fields 59 (title) & 60 (description) - and I can get them to output like this:

1. title1
2. title2

1. description1
2. description2

But - I want to merge them:

1. Title1
Description1

2. Title2
Description2

I guess I need to understand the php code more on how to implement it. Here's my code:
Code:
<?php //title $title_id = 59; // brief $brief_id = 60; // Use in ITEM view / Category (multi-items) view $titlevals = $item->fieldvalues[$title_id]; // or $items[$i] for category view $briefvals = $item->fieldvalues[$brief_id]; if (!empty($titlevals)) foreach ($titlevals as $t) { if ( @unserialize($t)!== false || $t=== 'b:0;' ) $v = unserialize($t); // var_dump($v); } if (!empty($briefvals)) foreach ($briefvals as $brief) { if ( @unserialize($brief)!== false || $brief=== 'b:0;' ) $v = unserialize($brief); } if (!empty($titlevals) or !empty($briefvals)) foreach ($titlevals as $t) { echo '<h3>'.$t.'</h3>'; } if (!empty($briefvals)) foreach ($briefvals as $brief) { echo '<p>'.$brief.'</p>'; } ?>

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

More
8 years 7 months ago #56840 by iamrobert
Ok - this seems to work. Now - to make the actual accordion.
Code:
<?php //title $title_id = 59; // brief $brief_id = 60; // Use in ITEM view / Category (multi-items) view $titlevals = $item->fieldvalues[$title_id]; $briefvals = $item->fieldvalues[$brief_id]; if (!empty($titlevals)) foreach ($titlevals as $t) { if ( @unserialize($t)!== false || $t=== 'b:0;' ) $t = unserialize($t); // var_dump($v); } if (!empty($briefvals)) foreach ($briefvals as $brief) { if ( @unserialize($brief)!== false || $brief=== 'b:0;' ) $brief = unserialize($brief); } $count =0; if (!empty($titlevals) or !empty($briefvals)) foreach ($titlevals as $t) { $title_value[$count] = $t; $count++; } $count2 =0; if (!empty($briefvals)) foreach ($briefvals as $brief) { $brief_value[$count2] = $brief; $count2++; } for($i=0; $i<$count; $i++){ echo '<h3>'.$title_value[$i].'</h3>'.'<p>'.$brief_value[$i].'</p>'; } ?>

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

More
8 years 7 months ago #56841 by iamrobert
I am looking at adding images - and the following code works to unserialize the image. I can insert the displayname + alt text. But - then I realize the URL will be different from the one generated by phpthumb:

/images/stories/flexicontent/item_32_field_61/l_tft.png

So - how do we include the actual filename version?
Code:
<?php $count3 =0; if (!empty($imagevals)) foreach ($imagevals as $imagev) { $image_value[$count3]= unserialize($imagev); $count3++; } for($i=0; $i<$count; $i++){ echo '<img src="'.JURI::root().'images/prod-icons/'.$image_value[$i]['originalname'].'" alt="'.$image_value[$i]['alt'].'" />'; } ?>

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.751 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline