views:

17

answers:

0

Hello!

I am making a table of DJ mixes in WordPress and using the duplicate group / custom field functionality of magicfields (a fork of the flutter plugin) to 'CMS-i-size' the process of adding a new mix to the table.

The order of the mixes matters: I need to put the first mix in the section, the rest in the section.

Right now I am able to retrieve only the first field for the section, but don't know how to write a code that says "show the rest of the duplicate groups EXCEPT the first". Here's the code:

                    <table>
                        <thead>
<?php
  // get_group returns an array with all of the groups and fields of the group
  // the first parameter is the name of the group
  $mixes = get_group('mix');
  // to be able to see how this array is formed, you can use pr($mixes);
  // the form of the array is
  // [group index][field name][field index]
 {
?>
                            <tr>
                                <th class="mixTitleCell">
                                    <h5><?php echo $mixes[1]['mixTitle'][1] ?></h5>
                                    Mixed by: <?php echo $mixes[1]['mixAuthor'][1] ?><br/>
                                    <?php echo $mixes[1]['mixDate'][1] ?>
                                </th>

                                <th class="mixDescCell">
                                    <?php echo $mixes[1]['mixDescription'][1] ?>
                                </th>

                                <th class="mixPlayCell">
                                    <a href="<?php bloginfo('wpurl'); ?>/wp-content/mixes/<?php echo $mixes[1]['mixLink'][1] ?>">Play/Pause</a>
                                </th>
                            </tr>
<?php } ?>
                        </thead>
                        <tbody>
<?php
   // getGroupOrder returns an array with the order of the groups
   // The next parameter ('mixTitle') is the name of the first field in the group
   $mixes = getGroupOrder('mixTitle');
   foreach($mixes as $mix){ ?>
                            <tr>
                                <td class="mixTitleCell">
                                    <h5><?php echo get('mixTitle',$mix); ?></h5>
                                    Mixed by: <?php echo get('mixAuthor',$mix); ?><br/>
                                    <?php echo get('mixDate',$mix); ?>
                                </td>

                                <td class="mixDescCell">
                                    <?php echo get('mixDescription',$mix); ?>
                                </td>

                                <td class="mixPlayCell">
                                    <a href="<?php bloginfo('wpurl',$mix); ?>/wp-content/mixes/<?php echo get('mixLink',$member); ?>">Play/Pause</a>
                                </td>
                            </tr>
<?php } ?>
                        </tbody>
                    </table>

So I need to modify the getGroupOrder in the section to not retrieve the first duplicate group.

I think incorporating the following code from this tutorial would be a step in the right direction, but I don't know PHP well enough to integrate the two (following code from http://www.doc4design.com/articles/flutter-duplicate-fields/):

<?php $total = getGroupDuplicates('firstFieldName');?>
<?php for($i = 1; $i < $total+1; $i++):?>

Thanks alot for your help!