List Radio Butons

2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 14, 2021   (RSS)

By daniel - June 14, 2021

Hi MercerDesign,

If you're using a typical generated details page that has a getRecords that looks like this:

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

You could then use something like this to get projects from that category:

    // load records from 'project'
    list($projectRecords, $projectMetaData) = getRecords(array(
        'tableName'   => 'project',
        'loadUploads' => true,
        'allowSearch' => false,
        'where'       => mysql_escapef('categoryNum = ?', getLastNumberInUrl()),
    ));

The important portion is the 'where' option; you'll need to update "categoryNum" to be the category field in your project section. You'll also need to modify any other table/field names to suit your actual sections.

Let me know how you're able to get on with that, or if you have any other questions!

Thanks,

Daniel
Technical Lead
interactivetools.com