$inflator->setOutDir(PRODUCTION_DIR); $inflator->setStartRepetionPlaceholder(START_REP); $inflator->setEndRepetionPlaceholder(END_REP); $preferenceFilename = "impostazioni.txt"; $inflatorHeader = new Inflator(); $inflatorHeader->setTemplate($preferenceFilename); $inflatorHeader->setOutDir(PRODUCTION_DIR); $textCompany = "Consulta l'elenco delle Aziende diviso per settori."; $textTicket = "Richiedi ora il Tuo Biglietto di Ingresso Gratuito!"; $titleCompany = "clicchi per visualizzare l'elenco dei settori"; $titleTicket = "richiedi il tuo biglietto di ingresso gratuito"; $headerData = [["Colloqui in Fiera", "*****@*****.**"], ["Forum Agenti a Fiera Milano", "*****@*****.**"], ["Fiera Ricerca Agenti", "*****@*****.**"]]; $headerDataSize = count($headerData); $counter = 0; foreach ($dataGrouped as $key => $bigBblock) { $blocks = $parser->divide($bigBblock, BLOCK_SIZE); foreach ($blocks as $index => $smallBlock) { $counter++; $counter = $counter % $headerDataSize; $alternate = $inflator->multiAlternate($smallBlock, []); $newContent = $inflator->inflate($alternate); $escaped = $parser->escapeSymbols($newContent); // $dirName = date('Y_m_d') . "_ForumAgentiMilano_{$key}_{$index}" . DIRECTORY_SEPARATOR; // $filePath = preg_replace("/\s+/", "_", $dirName . "{$key}_{$index}.html"); $dirName = str_replace('#DIR_MARKER#', "{$key}_{$index}", DIR_NAME_PATTERN); $fileName = str_replace('#FILE_MARKER#', "{$key}_{$index}", FILE_NAME_PATTERN); $filePath = preg_replace("/\\s+/", "_", $dirName . $fileName); $inflator->save($filePath, $escaped); $headerContent = $inflatorHeader->inflate([['#SECTOR#' => ucwords(strtolower($key)), '#FROM#' => $headerData[$counter][0], '#EMAIL#' => $headerData[$counter][1], '#DATE#' => date('d/m/Y')]]); $inflatorHeader->save(preg_replace("/\\s+/", "_", $dirName . $preferenceFilename), $headerContent); }