need num of related record in checkboxk field

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

Re: [Deborah] need num of related record in checkboxk field

Hi Deborah,

I think you can get this data fairly easily without having to use the related records plugin. You could try doing something like this:

// load record from 'category'
list($workshopsRecords, $workshopsMetaData) = getRecords(array(
'tableName' => 'workshops',
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$workshopRecord = @$workshopsRecords[0]; // get first record
if (!$workshopRecord) { dieWith404("Record not found!"); } // show error message if no record found


$listOfPresenters = array_combine($workshopRecord['workshop_presenters:values'],$workshopRecord['workshop_presenters:labels']);

foreach($listOfPresenters as $key => $item){
echo $item." ".$key;

}


Although you might have to do a slightly more complex query if your looking to get more data on each presenter than this. But even then I think it would be simpler to write the code to do it than to use the related records plugin.

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] need num of related record in checkbox field

Greg,

Thanks so much for the suggestion. I wasn't ablel to get the code working for me. I'll move on to 'Plan B', but wanted to say "thanks".

~ Deborah