// *********************************************************************************************************************************//// fmGenerateFieldConstants//// Get the fields on a layout (along with any portals) as a series of PHP define() statements.// This is useful when you are first creating the field constants for a new layout you're working with.//// This function is based on some earlier code I came across years ago. Unfortunately I don't remember// who it was from. If you know please contact me and I'll note their original contribution!//// Mark DeNyse, Driftwood Interactive, Inc. mark@driftwoodinterative.com//// *********************************************************************************************************************************function fmGenerateFieldConstants($dataBase, $hostName, $userName, $password, $layoutName, $tableName = ''){// Tweak these values as per your personal/business preference$fieldPrefix = 'FM_';$fieldSuffix = '_FIELD';$keyValueSeparator = " "; // Some people like tabs "\t"$newLine = "\n";

// If anyone can find a way to programmatically determine the base table name from a layout please let me know! // In the meantime, we pass in our name or leave it blank and use the layout name as our 'table' name.$tableName = (($tableName != '') ? $tableName : $layoutName);

// Now do any portals. A constant for the table occurence name is also generated.$relatedSets = $layoutObject->getRelatedSets(); if (! FileMaker::IsError($relatedSets)) { foreach($relatedSets as $relatedSet) {$php .= $newLine;