Fieldx and Groupx store are a little different than most other fields, because they contain multiple values. In SEBLOD there are two main options for displaying them in a custom template.
Honoring all parameters and typos set in the backend
$cck->renderField( 'your_fieldx_or_groupx' );
Because it outputs the loop plus formatting, renderfield is quick and easy and works well in some cases.
Field X Raw with no formatting
This example uses the Field X information to create an image. So, the value stored in the Field X is wrapped in img HTML tags
<?php foreach($cck->get( 'your_fieldx' )->value as $fx){ ?> <img src="/<?php echo $fx->value; ?>" alt="<?php echo $fx->image_alt; ?>" title ="<?php echo $fx->image_title; ?>" /> <?php } ?>
Group X Raw with no formatting
Again, using an example of unpacking the information to create an image
<?php foreach($cck->get( 'your_groupx' )->value as $gx){ ?> <p><img src="/<?php echo $gx['your_image']->value; ?>" alt="<?php echo $gx['your_image']->image_alt; ?>" title ="<?php echo $gx['your_image']->image_title; ?>" /></p> <p><?php echo $gx['text_field']->value; ?></p> <p><?php echo $gx['second_text_field']->value; ?><p> <?php } ?>
The advantage of getting the raw values is that you have complete control over the html that is created. Useful when you are working, particular layouts or scripts, or you just want the leanest possible code.
Calling a specific row from a groupx
Here's how you can call a specific row (or field from a row) from you groupx:
$cck->getValue( 'groupx_fieldname', 0, 'fieldname' );
$cck->getTypo( 'groupx_fieldname', 1, 'fieldname' );
$cck->getValue( 'groupx_fieldname', 0, 'fieldname' );
$cck->getTypo( 'groupx_fieldname', 1, 'fieldname' );
This post was originally created for SEBLOD 2.x by Unleash.it
NOTE: While this is not directly related to overrides, users often use overriding docs when developing for code fields: since Seblod 3.10 you need to use values property (not value) to get groupX or FIeldX array of values from beforeStore and afterStore code field.
NOTE: While this is not directly related to overrides, users often use overriding docs when developing for code fields: since Seblod 3.10 you need to use values property (not value) to get groupX or FIeldX array of values from beforeStore and afterStore code field.