Login | Sign up | Toll-Free: 1-800-752-0455



5 posts by 2 authors in: Forums > CMS Builder
Last Post: July 14, 2017


I would like to add two extra info upload fields. Can I do this simply by creating the extra fields here:


I am guessing that any changes to this file will be overwritten when I upgrade?

Would any information that I have added to these fields also be overwritten with an upgrade, or would the database info stay intact and just cause an error until I recreate the fields?

Is there a better way of doing this?


Hi Jeff, 

The 5 upload info fields are hardcoded in a number of places through the code so there is no easy way to add to them.  

What you might try as an alternative is to create a section for uploads with one upload field (with no info fields) and then add extra fields to that section.  So you'd have an upload field and whatever other text, textbox, etc other fields you wanted.

Then you could associate those uploads with another section using a related records field.

Hope that helps!

Dave Edis - Senior Developer

Hi Dave

Thanks for the advice. I have done as you suggested and have set up a related records field. I have used the CMSB relatedRecordLookupFunctions plugin and a tutorial by Jerry Kornbluth to achieve this.

I have everything set up perfectly on a standalone detail page. Ideally though I would like to integrate it with your CMSB Instant Website Template, and I am stuck. Currently, in my standalone page, my Range section editor pulls in records from the Products section editor: 

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


<?php if ($rangesRecords): ?>
    'table'      => 'ranges',   
    'recordList' => &$rangesRecords,   
    'fieldList'  => array( 'products' )    
  $rangesRecord = @$rangesRecords[0]; // get first record 
<?php endif ?>

My problem is how to implement the above lookupRelatedFields array into the structure of the IW website_init.php (extract below).

// load pages
list($categories, $selectedCategory,) = getCategories(array(
  'tableName'            => 'iw_pages',
  'defaultCategory'      => 'first',    // Enter 'first', a category number, or leave blank '' for none
//  'selectedCategoryNum'  => '',         // defaults to getLastNumberInUrl()
  'categoryFormat'       => 'showall',  // showall, onelevel, twolevel, breadcrumb
  'ulAttributesCallback' => 'customMenuUlAttr', // ADVANCED: custom function to return ul attributes, eg: myUlAttr($category);
  'liAttributesCallback' => 'customMenuLiAttr', // ADVANCED: custom function to return li attributes, eg: myLiAttr($category);
$page = $selectedCategory;

function customMenuUlAttr($category) {
  return ($category['_hasParent'] && $category['depth'] == '1')? "class=\"dropdown-menu\" role=\"menu\"" : "" ;

function customMenuLiAttr($category) {
  return ($category['_hasChild'] && $category['depth'] == '0')? 'class="dropdown"': "" ;

Thanks in advance,

Hmm, I haven't used that plugin in a long time so I'm not sure.  

One thing you can try is using showme() to see the contents of that variable <?php echo showme($rangesRecord); ?>

Perhaps it's added some fields that you can now output on the page? 

Dave Edis - Senior Developer