Skip to content Skip to sidebar Skip to footer

"template" Of Sorts For Html Website

I have a website which currently resides in the form of HTML files in my server's folder. I have some elements that are present on each page, and have to be the same, e.g. the navb

Solution 1:

The only way to go without the server-side is javascript. See Aviatrix's post for a JS template.

In your case, and only if server-side IS ACCEPTABLE for you, I would rather go for a more generic approach; instead of having your navbar in each file/page, create your navbar one time in a separate file, and use it in every page (php or other ssi approach is needed).

Solution 2:

I don't know if this is too much for your use case, but there is the handlebars.js library available for Javascript and HTML templating. Of course you would need to program Javascript then.

Solution 3:

Form what I undarstand you are in need for a JS templating engine of sorts :

http://handlebarsjs.com/

is what might fit your needs

Solution 4:

You should be able to do

<!--#include virtual="path/file.html" -->

also, see How to include an HTML page into another HTML page without frame/iframe?

Solution 5:

Of course that is possible. For example with jQuery. See the .load() function here.

Post a Comment for ""template" Of Sorts For Html Website"