I am thinking a way to add navigation bars to all of my webpages, and when I update the file, all pages should also update.
I researched on Google for a bit of time, what I found are:
PHP
SSI
(I don't even konw what's this) JavaScript
But which one is the best? And can someone explain what SSI
is?
PHP would work fine, but using it would mean you'd have to set things up a bit differently, including doing things like:
.html
files to .php
.php
filesrequire
SSI (Server Side Includes) are some ancient thing that nobody uses. Don't use them. But if you're curious, take a look at mod_include.
Client-side javascript could sort of be made to work, but you're better off doing this kind of thing on the server.
Here are some other options to consider.
PHP isn't the only server-side language. You might prefer python, ruby, server-side javascript, etc.
XSL transformations are well-suited to this kind of templating, and can be applied either by the browser or on the server. Support is good across browsers, and has been for some time. Extensions like "noscript" tend to break XSL transformations in some browsers, so applying them on the server is usually preferred when possible.
You could simply put your navigation in a separate HTML file and include it in an iframe
on every page. Only use this as a last resort. If you cannot use a server-side language, cannot or do not want to use XSLT, and have relatively few pages, this might work okay. Otherwise, don't do it.