For this question, I'm going to imagine that your website has a structure like this (it's probably a bit different, adapting the code should to your structure should be simple):
/
├ index.php
├ articulo.php
├ encabezado.php
├ pie.php
└ articulos/
├ articulo1.html
├ articulo2.html
├ articulo3.html
├ ...
In your file articulo.php is where you have the header and foot with a require() , then what you should do is the following:
Pass the article that you want included in the header
Read in% co_of% what article
Add the article's html using $_GET or require() (as you're already doing for the header and footer)
Whereas the article would be passed in the header as follows: include() , then this would be done as follows in articulo.php?articulo=articulo1 ,:
<?php
// incluimos la cabecera
require("cabecera.php");
// si se ha pasado el articulo y existe su fichero html
$articulo = filter_input(INPUT_GET, "articulo");
if (isset($_GET["articulo"]) && file_exists("articulos/$articulo.html")) {
// se incluye en la página
require("./articulos/$articulo.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");