FLEXIcontent Field Group Accordion

More
10 years 5 months ago - 10 years 5 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: 10 years 5 months ago by iamrobert.

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

More
10 years 5 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 review. Thanks!

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

More
10 years 5 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 review. Thanks!

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

More
10 years 5 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
10 years 5 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
10 years 5 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.

More
10 years 5 months ago - 10 years 5 months ago #56843 by ggppdk
Hello

are you asking or are you giving the answer ?

you probably do not want to use phpThumb but some of the thumbnails
s_
m_
l_
Code:
$imgField = $item->fields[IMAGE_FIELD_NAME]; echo $field->thumbs_src['medium'][0];


-- 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: 10 years 5 months ago by ggppdk.

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

More
10 years 5 months ago #56847 by iamrobert
Thanks.

I'm asking - as I'm trying to work my way through it and will write a little tutorial/snippets file when done.

I needed to edit the code:
Code:
$imgField = $item->fields['inno_image']; for($i=0; $i<$count; $i++){ // echo '<h3>'.$title_value[$i].'</h3>'.'<p>'.$brief_value[$i].'</p>'; echo '<img src="'.$imgField->thumbs_src['large'][$i].'" alt="'.$image_value[$i]['alt'].'" />';

This seems to work.

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

More
10 years 5 months ago #56883 by iamrobert
Here's my final code - if anyone is interested:
Code:
<?php //title $title_id = 59; // brief $brief_id = 60; // image $image_id = 61; // Main Text/Complete $maintext_id = 62; // Use in ITEM view / Category (multi-items) view $titlevals = $item->fieldvalues[$title_id]; $briefvals = $item->fieldvalues[$brief_id]; $imagevals = $item->fieldvalues[$image_id]; $maintextvals = $item->fieldvalues[$maintext_id]; // Title if (!empty($titlevals)) foreach ($titlevals as $t) { if ( @unserialize($t)!== false || $t=== 'b:0;' ) $t = unserialize($t); // var_dump($v); } // Brief Text/Intro text if (!empty($briefvals)) foreach ($briefvals as $brief) { if ( @unserialize($brief)!== false || $brief=== 'b:0;' ) $brief = unserialize($brief); } // Image if (!empty($imagevals)) foreach ($imagevals as $imagev) { if ( @unserialize($imagev)!== false || $imagev=== 'b:0;' ) $imagev = unserialize($imagev); } // Main Text/Complete if (!empty($maintextvals)) foreach ($maintextvals as $maintext) { if ( @unserialize($maintext)!== false || $maintext=== 'b:0;' ) $maintext = unserialize($maintext); // var_dump($maintext); } $count =0; if (!empty($titlevals) or !empty($briefvals) or !empty($imagev) or !empty($maintextvals)) foreach ($titlevals as $t) { $title_value[$count] = $t; $count++; } $count2 =0; if (!empty($briefvals)) foreach ($briefvals as $brief) { $brief_value[$count2] = $brief; $count2++; } $count4 =0; if (!empty($maintextvals)) foreach ($maintextvals as $maintext) { $maintext_value[$count4] = $maintext; $count4++; } $count3 =0; if (!empty($imagevals)) foreach ($imagevals as $imagev) { $image_value[$count3]= unserialize($imagev); $count3++; } $imgField = $item->fields['inno_image']; echo '<ul class="small-block-grid-1 medium-block-grid-3">'; for($i=0; $i<$count; $i++){ echo '<li><ul class="accordion" data-accordion="myAccordionGroup"><li class="accordion-navigation">'; echo '<a href="#panel'.$i.'"><img src="'.$imgField->thumbs_src['large'][$i].'" alt="'.$title_value[$i].'" /></a>'; echo '<div id="panel'.$i.'" class="content">'; echo '<h3 class="red">'.$title_value[$i].'</h3>'.'<h4 class="grey">'.$brief_value[$i].'</h4>'; echo $maintext_value[$i].'<hr></div>'; //echo '<img src="'.$imgField->thumbs_src['large'][$i].'" alt="'.$image_value[$i]['alt'].'" />'; echo '</li></ul></li>'; } echo '</ul>'; ?>

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

Moderators: vistamediajoomlacornerggppdk
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
Save