Show Records Individually

3 posts by 3 authors in: Forums > CMS Builder
Last Post: March 1, 2021   (RSS)

I have a multi record section that contains a record for type of service a landscaping company provides such as Landscaping, Mowing and Excavating.  I would like to have a record in the section for each of the services.

For the viewer, I would like to select each of the records individually to show on the proper place on the page.  The foreach loop won't work as each area the record is to be displayed is laid out differently.

So I want to be able to show all of the records on the page, just individually on the page using a where clause using the title field in the record.

I know there has to be a simple way to do this, but I could not find any example.

Thanks

Phil

By mizrahi - February 9, 2021

I think this is what you're looking for:

<?php foreach ($services as $record): ?>
	<?php if($record['title'] != "Mowing") continue; ?>
	<h1><?php echo $record['title']; ?></h1>
	<?php echo $record['content']; ?>
<?php endforeach ?>


<?php foreach ($services as $record): ?>
	<?php if($record['title'] != "Landscaping") continue; ?>
	<h1><?php echo $record['title']; ?></h1>
	<?php echo $record['content']; ?>
<?php endforeach ?>


<?php foreach ($services as $record): ?>
	<?php if($record['title'] != "Excavating") continue; ?>
	<h1><?php echo $record['title']; ?></h1>
	<?php echo $record['content']; ?>
<?php endforeach ?>