I have a directory with .html files that are articles for a post
I recently asked a question on this site and they recommended this code that works perfect for the question.
<?php
// incluimos la cabecera
require("cabecera.php");
// si se ha pasado el articulo y existe su fichero html
if (isset($_GET["articulo"]) && file_exists("articulos/".$_GET["articulo"].".html")) {
// se incluye en la página
require("./articulos/articulo1.html");
} else {
// si no se ha pasado id del artículo o no existe, se muestra un error
echo "Artículo no especificado o no existente.";
}
// incluimos el pie
require("pie.php");
link of the question: display html files of a directory in a php
Now what I need is to make a require of all the .html files of a directory, so that I do not have to add the code for each new file.html that it generates.