$field_list .= $fieldname[$j] . " " . $realfieldtype . " NOT NULL ,";
    }
    $create_query .= substr($field_list, 0, -1);
    $create_query .= ") ENGINE = MYISAM";
    mysql_query($create_query);
    unset($fields);
    unset($fieldcount);
    unset($fieldtext);
    unset($fieldname);
    unset($fieldtype);
    unset($field_list);
    unset($create_query);
}
printf($scaffold->openFileClassMessage);
require_once "../utils/Fileoperation.php";
$fo = new Fileoperation();
//DEFINE LOCATIONS TO PUT GENERATED FILES
$slimapp_dir = "../../api/";
$slimmodel_dir = "../../api/model/";
// MAIN APP FILE
$appclass_file = $fo->OpenFile('../template/', 'slim_index.php.tmpl', 'r');
$appclass_content = $fo->FileContent($appclass_file);
$appdbconfig = "R::setup('mysql:host=localhost;dbname=" . DATABASE_NAME . "','" . DATABASE_USERNAME . "','" . DATABASE_PASSWORD . "');";
$appclass_content = preg_replace('/PATDBCONFIGPAT/', $appdbconfig, $appclass_content);
#################################
# CLASS AND COMPONENTS CREATION
#################################
printf($scaffold->classComCreateMessage);
/*
LOOP OVER ALL TABLES DEFINED IN YAML FILE
THIS WILL LOOP ON EVERY TABLE ON THE YAML CONFIG.
    $CONFIG = Spyc::YAMLLoad($yamlconfig);
} else {
    die($scaffold->appConfigErrorMessage);
}
printf($scaffold->configArrayLoadedMessage);
//INITIALIZING PROCESS
printf($scaffold->objectArrayInitMessage);
$tablecount = count($CONFIG);
if ($tablecount == 0) {
    die($scaffold->noTableInDbErrorMessage);
}
// = = = = = = = = = = = = = = = = = =
// = = = = = = = = = = = = = = = = = =
printf($scaffold->openFileClassMessage);
require_once "../utils/Fileoperation.php";
$fo = new Fileoperation();
// = = = = = = = = = = = = = = = = = =
//DEFINE LOCATIONS TO PUT GENERATED FILES
$htmlmain_dir = "../../app/";
$htmlview_dir = "../../app/views/";
$jscontrol_dir = "../../app/controllers/";
$jsservice_dir = "../../app/services/";
if (!file_exists($htmlmain_dir)) {
    mkdir($htmlmain_dir, 0755);
}
if (!file_exists($htmlview_dir)) {
    mkdir($htmlview_dir, 0755);
}
if (!file_exists($jscontrol_dir)) {
    mkdir($jscontrol_dir, 0755);
}