+ 3

Can we include HTML file in php code ?

I have my header, footer in HTML extension can I include it into the php file using include function.

28th Sep 2016, 8:40 AM
Suryaprakash Tiwari
Suryaprakash Tiwari - avatar
8 Answers
+ 4
Yes, We can include it into our php pages.
28th Sep 2016, 8:40 AM
Suryaprakash Tiwari
Suryaprakash Tiwari - avatar
+ 2
Yes you can <?php include('file.html'); ?> <?php include 'file.html'; ?> Both will work
26th Dec 2016, 12:02 PM
Raniket Ram
Raniket Ram - avatar
+ 1
yes you can . juste open the PHP statement <?PHP and write you code and finish with > if you want to use thé incluse fonction, you must sage yiyr file with PHP extension
23rd Nov 2016, 5:05 AM
Bove Bove
Bove Bove - avatar
+ 1
of course yes
24th Nov 2016, 7:55 PM
Adesina Oluwatoyin E
Adesina Oluwatoyin E - avatar
+ 1
<?php include 'header.html'; //your codes here include 'footer.html'; //be sure including your actual path ?>
3rd Dec 2016, 3:48 AM
Debendra Oli
0
yes
28th Dec 2016, 4:41 PM
saikumar
saikumar - avatar
- 2
you can do this with the include/require function. require_once 'header.html'; the content is parsed as php so you can use php in those files even if they are .html
24th Nov 2016, 5:49 AM
Moritz Poldrack
Moritz Poldrack - avatar
- 4
Yes. like that <?php echo "<h1>Title </h1>"; ?> Or like that. <?php echo ?> <h1>Title </h1> <p>Lorem ipsum... </p> <?php ?>
28th Sep 2016, 1:51 PM
Driss Baidou
Driss Baidou - avatar