Server-side Starter Tutorial:Includes - Part 4 of 7

That's all very well but ...

I can change the background to every page of my site by editing a single CSS file that is external to each page if I had the following code as part of the head of all my HTML page:

<link href="mysite.css" rel="styleSheet" type="text/css">

True. You could. Not only that, but you could have used standard HTML includes to achieve what we've shown so far. For example if you collected all of your site's standard navigation links and saved them as an html file named nav-links.html, you could include one line on every page in place of your navigation code:

<!--#include file="nav-links.html" -->

So what's the point of php includes?

Well, php includes sounds cool. No, that's not the point!

The benefit to using php includes is that they have all the same maintenance-reducing, development time-reducing aspects of using external CSS and javascript files and HTML includes .... but with brains.

Remember that php is a scripting language so it can accept variables, undertake conditional actions based on those variables, and a whole host of other things.

«  previous  |  next  »  

Site Links

 

Starter Tutorials