Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Web
Expertise: Intermediate
Mar 5, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Including Boilerplate Text

If you have header or footer material which appears on every page in your site, such as navigation or copyright information, it makes sense to store it centrally and use server-side includes to make it appear where needed. That way, if you change anything, you only have to change it once for it to show up everywhere.

If you have header material in a file called header.html, you can include it in a page like so:

<!--#include file="header.html"-->

If the include files are stored in their own directory, you'll need slightly different syntax:
<!--#include virtual="../../includes/header.html"-->
For any of this code to work, you'll need to make sure that your server is configured to parse HTML pages. Pages with server-side includes usually have the .shtml extension, to let the server know they should be parsed. It's possible to configure your server to parse all HTML files, but that will slow everything down considerably.
Steve Renaker
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date