Adding a variable number of links to a detail page

5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 11, 2010   (RSS)

By steve_e - March 9, 2010

Hi -
I can't think of a way of doing this although it may be simple (or possible with a later version; I'm currently still on 1.22)?

I'd like to be able to allow my editors to add a variable number of links to forum conversations into a newsletter. The links would need to have a title, the URL and a pulled quote from the discussion, so three different elements.

I could allow them to do this just by creating a wysiwyg text box and allowing them to edit the three elements in themselves. However to avoid the risk of formatting problems and inconsistencies, I'd rather have them inputting it via three separate fields which I then format via the detail page template for each newsletter.

But I can't see a way of breaking it down in this way when there will be a variable number of instances. I suppose what I want is something similar to the uploads or images dialogue, where you add a caption, an image and so on to each instance of a field. And can add an indefinite number of them to a record.

Does that make sense?

Re: [chris] Adding a variable number of links to a detail page

By steve_e - March 10, 2010

Thanks for this Chris. Just to clarify then (I'm not much good at db concepts!) the conversationNum field would be the link to a particular newsletter, so however many conversations you'd want to include in the March Newsletter, you'd give a value of something like 'Mar2010' to and then reference this in the detail page of the March Newsletter?

Re: [steve_e] Adding a variable number of links to a detail page

By Chris - March 10, 2010

Hi steve_e,

Essentially, yes. It's safer to use the "num" of the record (i.e. newsletter) you're linking to because the num won't change.

You'd probably do something like this in your detail page:

list($newsletterRecords, ) = getRecords(array(
'tableName' => 'newsletter',
'where' => whereRecordNumberInUrl(1),
));
$newsletterRecord = @$newsletterRecords[0];
if (!$newsletterRecord) { die("Could not find newsletter record"); }

list($linkRecords, ) = getRecords(array(
'tableName' => 'link',
'where' => mysql_escapef("newsletterNum = ?", $newsletterRecord['num']),
));


I hope this helps. Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Adding a variable number of links to a detail page

By steve_e - March 11, 2010

Thanks Chris. [:)]