Elimate Duplicate Items from a for each

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 17, 2014   (RSS)

I'm creating a tag menu based on the titles of a list page. I am struggling with eliminating duplications of the same event title. It seems this should be easy, but the various codes I find around the forums and internet don't seem to work right for this. I've tried a variety of array_unique situations, but can't seem to get it right. Please advise.

<?php foreach ($events_listRecords as $record): ?>
  <a href="http://abc.com/title=<?php echo htmlencode($record['title']) ?>"><?php echo htmlencode($record['title']) ?></a>
<?php endforeach; ?>

Perfect! Thank you so very much. And thank you for the explanation of why it works also.

Josh