polyfade
Member
Posted 1 year ago #
Would someone please assist? I'm not the most fluent PHP person. I first looked at the Magic Fields wiki and I still can't figure out my problem.
Simply put, I added a post to a category 'Fave' which I set up using Magic Fields. Inside I created 3 groups of information that I want to show.
I can get one group to display successfully, but the others won't print out.
I'm guessing I have to use 'for each' statement, but how? My code so far is shown below:
<h2><?php echo get('fave_detail_title'); ?></h2>
<?php echo get('fave_detail_image'); ?>
<?php echo get('fave_detail_summary'); ?>
<p><?php echo get('fave_detail_location'); ?></p>
<p><a href="http://<?php echo get('fave_detail_link'); ?>">View this</a></p>
polyfade
Member
Posted 1 year ago #
sorry, just too much fatigue.
i started fresh and got it to work.
this tutorial is a bit more comprehensive:
http://www.doc4design.com/articles/magic-fields-duplicates/
as noted, the english translation of magic fields wiki is not completely translated so it could be difficult to understand especially under tired vision.
this is a fantastic plugin!
Thanks, I came looking for exactly this solution.
Although, I have a duplicate field that has a series of checkboxes and it only outputs as "Array". Not sure how to make it output.
<?php $myEvent = get_group('class');
foreach($myEvent as $event){ ?>
<div class="row">
<span class="class_time"><?php echo $event['class_time'][1]; ?></span>
<span class="class_name"><?php echo $event['class_name'][1]; ?></span>
<span class="class_location"><?php echo $event['class_location'][1]; ?></span>
</div>
<?php } ?>
That's what I'm using, class_location just shows as "Array".
Figured it out. Just put another foreach in for the class_location
<?php $mytitle = $event['class_location'][1];
foreach($mytitle as $title){ ?>
<span class="class_location"><?php echo $title; ?></span>
<?php } ?>