Assigning Uploads to Multiple Records so links to downloads appear on record.

2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 25, 2010   (RSS)

Re: [zick] Assigning Uploads to Multiple Records so links to downloads appear on record.

By Jason - November 25, 2010

Hi Zick,

It sounds like you pretty much have this worked out. You should set your Instructional Documents section as a multi-record section rather than a category section.

Have a multi-select drop down list in your franchise section that pulls data in from your Instructional Documents section. You can use whichever value you want for the label, but you should use the num field for the value.

On your franchise page, you just need to select all the Instructional Documents records where that record has been selected for that franchise.

CMS Builder stored multi-select values as a string separated by tab characters (\t).
You can use something like this:

$documentNums = str_replace("\t",",",trim($franchise['instructional_documents'],"\t"));

if(!$documentNums){$documentNums = 0;}

list($documentRecords,$documentMetaData)=getRecords(array(
'tableName' => 'instructional_documents',
'allowSearch' => false,
'where' => "num IN (".mysql_escape($documentNums).")",
));


In this example, $franchise is the record from the franchise record your displaying and the multi-value drop down field in that section is called "instructional_documents". At the end of this code, $documentRecords is all the record from the Instructional Documents section that were selected in the franchise section.

Give this a try and let me know if you run into any problems.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/