user1887109
user1887109

Reputation: 51

Saving HTML page as .php?

Right now I just have a simple HTML page and a Javascript before the </body> tag. Is it ok to save this page as .php and everything would work fine? I couldn't find an explanation while searching. Can someone explain, why is it ok to save an HTML page as .php?

Thanks.

Upvotes: 4

Views: 3495

Answers (3)

MCM
MCM

Reputation: 74

As an interesting and relevant aside; entire segments of a HTML site can be saved as separate PHP files and then brought into the website to form a whole. A good example is having one HTML navigation menu template which needs editing only once and, through PHP includes, updates on every page of your website.

Many popular websites and blogs use such a system for both convenience and consistency. In short, it is good practise to save segments of HTML code in this way.

Upvotes: 0

PeterJ
PeterJ

Reputation: 3795

Anything not included within PHP tags will be left "as is", so there's no problem doing that.

Upvotes: 0

Jonathon Reinhart
Jonathon Reinhart

Reputation: 137398

Yes, it will be fine. PHP only processes things within <?php ?> tags.

But why don't you just try it and see if it works? It would take you far less time than asking a question.

Upvotes: 3

Related Questions