prepare("SELECT * FROM glpi_newsletters WHERE id = ? AND archived = 0"); $stmt->bind_param("i", $newsletter_id); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 0) { Html::redirect($CFG_GLPI["root_doc"] . "/front/newsletter.list.php"); exit; } $newsletter = $result->fetch_assoc(); // Path stored in DB $path = $newsletter['path']; // e.g. "N1" or "N2" or folder name $title = $newsletter['title']; // ---------------------- Flipbook rendering ---------------------- echo "

".$title."

"; $files = scandir('../file_upload/newsletter/'.$path); $count = sizeof($files); echo '
'; $i = 2; // skip . and .. while ($i < $count) { echo '
Img '.($i).'
'; if ($count % 2 != 0 && $i+2 > $count) { echo '
Img 2
'; } else { echo '
Img '.($i+1).'
'; } if ($count % 2 == 0 && $i+2 >= $count) { echo '
Img 2
'; } $i += 2; } echo ''; ?>