Jump to content

HTML How do you create/use a "template" for multiple pages

Guest
Go to solution Solved by Guest,

Alright. Thanks to /r/web_design, I found out you can use this jquery:

$(function(){  $("#include_navbar").load("template.html"); });

To do this. Works great, exactly what I wanted.

Alright. Thanks to /r/web_design, I found out you can use this jquery:

$(function(){  $("#include_navbar").load("template.html"); });

To do this. Works great, exactly what I wanted.

Link to comment
Share on other sites

Link to post
Share on other sites

If you create a page with IFrames, then you can simply embed whichever pages you want in the template and change them at will.

I believe I was looking for this a while back, definitely making note of this!

My procrastination is the bane of my existence.

I make games and stuff in my spare time.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

You can use an absolute path for stuff

/guides/sandwhich.html
Which will work anywhere on your website.

 

Alright, so I tried that but the html files in folders don't have css.

<link rel="stylesheet" type="text/css" href="css/style.css"><link rel="stylesheet" type="text/css" href="css/links.css"><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Ubuntu">

This is in my template file which is being added via jquery to every page.

If I add a / to the href attributes then none of the pages have css

Link to comment
Share on other sites

Link to post
Share on other sites

Alright, so I tried that but the html files in folders don't have css.

<link rel="stylesheet" type="text/css" href="css/style.css"><link rel="stylesheet" type="text/css" href="css/links.css"><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Ubuntu"> 
This is in my template file which is being added via jquery to every page.

If I add a / to the href attributes then none of the pages have css

Have you tried Inspecting elements to see what the links look like if you have the / proceeding them?

15" MBP TB

AMD 5800X | Gigabyte Aorus Master | EVGA 2060 KO Ultra | Define 7 || Blade Server: Intel 3570k | GD65 | Corsair C70 | 13TB

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×