paste header and footer in several pages [duplicate]

1

Hello community, today I have a problem, I'm optimizing my business website so it's easier to work and I thought of including a header in all the pages, importing it from the html document the problem is that I do not know how to do it and search and search but no way it works, try iframe but I commented that it is not right then I stay in an uncomfortable situation, someone knows what to do in these cases?

    
asked by Reyes Jose 15.01.2018 в 02:21
source

3 answers

1

You can include your document using include

You put in the document

<?php
include ('header.html');
?>

So you will include everything your document has

    
answered by 15.01.2018 в 02:39
0

As simple as chewing gum, it only creates two html files. One called header.html and another footer.html . In the file header.html you will include all the code that you want to go in the header of the page. And in the file footer.html you will include all the code that you want to go in the footer. And as Edwin says, you will include it by php.

Let's say this is the code of your web page:

<!DOCTYPE>
<html>
<head>
    <title>Titulo de pagina</title>
</head>
<body>
<?php
include "header.html";
?>
// Todo el contenido de la pagina... etc...
<?php
include "footer.html";
?>
</body>
</html>
    
answered by 15.01.2018 в 03:30
0

If you handle it from a controller (MVC), you can call it like this:

$this->load->view("ruta_de_la_vista/archivo.html");

Inside the file HTML I would recommend that you only have the code you need, because, this way it should work structured .

If it's .php, you should only do it without the extension:

$this->load->view("ruta_de_la_vista/archivo");
    
answered by 15.01.2018 в 05:13