Multi records: Want listings to link to *some* details pages, but not all

4 posts by 3 authors in: Forums > CMS Builder
Last Post: September 2, 2016   (RSS)

By CommonSenseDesign - September 1, 2016 - edited: September 1, 2016

Hi, All.

I'm trying to create a multi record events page, some of which will just be the event's title and date, and some will need another page with more info (i.e. a link to a detail page). Is there a way of specifying that a record doesn't have a link to a detail page?

I know I could set up two separate multi record sections and leave the links out of the code for one, but I want to be able to mix the linked and non-linked records on the list page, which I guess would mean using just one multi record section.

Thanks!

By Toledoh - September 1, 2016

I normally check for any extra data... if there is, then show the link.  ie.  If I have a multi-record with a field "link_url" that sometimes has a website to link to, I would use the following:

<?php if ($record['link_url']): ?><a href="<?php echo ($record['link_url']) ?>" target="_blank">View website</a><?php endif ?>

Same with additional content.  If the "content" field is filled in, then display a link to the detail page. ie.

<?php if ($record['content']): ?><a href="<?php echo $record['_link'] ?>" target="_blank">Read more</a><?php endif ?>

Cheers,

Tim (toledoh.com.au)

By ross - September 2, 2016

Hi there.

I think Tim has you on the right track.

You could also create a checkbox called "Show Read More Link" and use that to determine if a record needs a "Read More" link.

I like Tim's idea better though as it uses fields you already have and doesn't require extra work to use.

Let us know any questions.

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/