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 CommonSenseDesign - September 2, 2016

That was pretty easy! Works perfectly - thank you.

http://interfaithcounselling.ca/news-events.php

I've added the word "Details" and a link if there is more information in the content field.