$fields = array('name', 'type', 'number', 'paper');
$query = "SELECT name, type, number, paper FROM `clientorders_components` WHERE parent_id='" . $focus->id . "' AND deleted=0";
$result = $focus->db->query($query, true, "Error filling layout fields: ");
while (($row = $focus->db->fetchByAssoc($result)) != null) {
    foreach ($fields as $field) {
        $data[$field] = $row[$field];
    }
    $list[] = $data;
}
//////////////
$xtpl = new XTemplate("modules/{$currentModule}/CreatePDF.html");
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$pdf = new HTML2FPDF();
$xtpl->assign("HEADER", $pdf->headerPDF());
$xtpl->assign("FOOTER", $pdf->footerPDF());
$xtpl->assign("ROWS", $pdf->CompRows($list));
$xtpl->parse("main.row1");
//Assign layout attributes
$xtpl->assign("LABEL_COLOR", $pdfColors["label"]);
$xtpl->assign("FIELD_COLOR", $pdfColors["field"]);
$xtpl->assign("colspan", count($fields));
$xtpl->assign("fSize", $pdfFontSize["default"]);
$xtpl->assign("headingFontSize", $pdfFontSize["heading"]);
$xtpl->assign("headingColor", $pdfColors["heading"]);
$xtpl->assign("titleColor", $pdfColors["headerFld"]);
$xtpl->assign("firstCol", "20%");
$xtpl->assign("secCol", "30%");
//Line divider attributes
$xtpl->assign("dividerHeight", "1px");
$xtpl->assign("dividerColor", $pdfColors["dividerColor"]);