Sarkar Hasan Sarkar Hasan - 2 years ago 73
PHP Question

Is it alright if I include multiple html files in a single php file?

I have a php file with multiple forms.. for simplicity's sake I have created multiple html file and each of them has a form and starts from

and ends with

the php file is something like this:


The result of this seems okay.. my question is, it is okay if I keep it like this or I have to create head.html and end.html then includes forms in between??
what is the differences??

Any help is appreciated

Answer Source

Yes, you can include as many as you want. But each html file should not contain <html /> enclosed. You should put it in your main file and the file which you want to include - in that file just use div wrapper to include your content. I mean you can use any html tag that you use the tag inside body tag.

But as per google page speed guide, you should maintain least html size as far as possible.

Here's an example:


<!DOCTYPE html>
  <title>Example page</title>

f1.html and f2.html:

your content
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download