Reputation: 11652
I have couple of plain html5 pages in websites. all of them have header and footer is the same. I would like to use master page concept for these pages. like asp.net masterpage (but I dont want use asp.net masterpage concept here). Simple way that I want. It is IIS web server.
Is there any otherway in htm5 other than asp.net masterpage?
Upvotes: 1
Views: 2856
Reputation: 13302
You can use SSI to import a header and footer file from another directory. You'll have to enable it in IIS as it's not enabled by default. You can read up on it here.
Basically, once you have it enabled in IIS, you can do:
<!--#INCLUDE VIRTUAL="/includes/header.htm"-->
To include the header.htm
file from the includes
folder in the root of your website at that point in your HTML.
Edit
Note: If you're using classic ASP, you can also pass variables into an included page which makes it handy for setting things like the <title> external to your template.
Upvotes: 1
Reputation: 943509
HTML has no (serious) templating facilities. Use a template language. ASP.NET masterpages are one option. Others include Template-Toolkit (Perl), Mustache (Cross-language) and Smarty (PHP).
Upvotes: 1