Can I use a template html page within another html page

Please support our Site Layout and Usability advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Aug 2006
Posts: 6
Reputation: Vicksley is an unknown quantity at this point 
Solved Threads: 0
Vicksley Vicksley is offline Offline
Newbie Poster

Can I use a template html page within another html page

 
0
  #1
Sep 1st, 2006
Hi all,

What I am trying to achieve, but have no idea how to go about it, is

I want to use a template banner/navbar/ that I have created myself for all pages on my site.

Is it possible to add a "include file" into my html pages so that if I need to change one thing on the navbar or banner page I should only have to do it once via the template page instead of having to do it on every page in the website.

I am hoping to do this without using a database or frames, maybe using javascript instead.

I am using dreamweaver 8 to create my site and I wanted to first get this right before I get on with the whole site.

I was also hoping to make the page load quicker by achieving this, so that it looks as though only the content is changing......

I am not sure how to go about this ....

Can anyone help me out by maybe shooting me in the right direction with some javascript code....where to place it and the call function to achieve it..

Do I have to save the template file as a js file??

Anyway I will leave it out there and see what you guys can come up with for me....

Thanks

Vick
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 434
Reputation: FC Jamison is on a distinguished road 
Solved Threads: 20
Team Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Can I use a template html page within another html page

 
0
  #2
Sep 1st, 2006
I use javascript for this.

I have a menu.js file that wil update my menu links sitewide. I do the same for my footer as well.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 6
Reputation: Vicksley is an unknown quantity at this point 
Solved Threads: 0
Vicksley Vicksley is offline Offline
Newbie Poster

Re: Can I use a template html page within another html page

 
0
  #3
Sep 1st, 2006
Yea.....that is kind of what I was hoping to do.....

Is it possible that you could help me with some of the coding for adding that page.......

as I do know that it can be done......Just not HOW to do it......... Could someone point me in the right direction of where to find the correct coding....as I am lost to the amount of info to look through on the net...

Thanks Vickie
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 57
Reputation: The Geeky Kid is an unknown quantity at this point 
Solved Threads: 1
The Geeky Kid's Avatar
The Geeky Kid The Geeky Kid is offline Offline
Junior Poster in Training

Re: Can I use a template html page within another html page

 
0
  #4
Sep 1st, 2006
PHP Include, I think this is what you're looking for, basically, you give this script, and you have index.php but that ONLY has the template, and the PHP Include script, PHP Include is easy to learn, and there is a GREAT tutorial at xndesigns.com, anyways, you say what your layout looks like, give all the coding, ect. but where you type text, you put in the script, and you say what the main page is gonna be, and what all the other pages are (you MUST have whatever.php if you want that to be a page, and it MUST be a PHP extension) , and now you have it so the links could be ?go=whatever or ?page=whatever, you get to decide that part too, i know, im confusing, Just go to XNDesigns already, lol
Please help get my computers connected through an ethernet cord!
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 434
Reputation: FC Jamison is on a distinguished road 
Solved Threads: 20
Team Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Can I use a template html page within another html page

 
0
  #5
Sep 1st, 2006
php is beyond my little brain at the moment...

for a banner...the quick and dirty javascript is

document.write('<a href="bannerLink.htm"><img src="yourImage.jpg" /></a>');

basically whatever you would put on the html page, you enclose in document.write(' '); in the javascript file.

You the just relace your html code with <<script type="text/javascript" src="yourScript.js"></script>

Let me know if you need more detail.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 6
Reputation: Vicksley is an unknown quantity at this point 
Solved Threads: 0
Vicksley Vicksley is offline Offline
Newbie Poster

Re: Can I use a template html page within another html page

 
0
  #6
Sep 2nd, 2006
Arggggg......

Thanks Deacon.....

that was sort of what I was after...and I did get some results with what you gave me.....

But not the result I was hoping for....I did get the images to load using the javascript...But I have CSS attatched to the html banner page and was kind of hoping that the whole page would load with the CSS attatched to it....Not just the images....


Thanks also to The geeky kid....but I havent had much experiance as yet with PHP......maybee I need to look into more of that....But I think that may include databases doesnt it?

Back to punching in more code for me....

Thanks guys.....any other help you may think of I would be glad to recieve the advice..

Vick



Never mind....I will try and play with it a bit more to hopfully get the result I need....

Thanks again for the codeing though......It did help....I could always just creat one image file instead of using three images and CSS....
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 434
Reputation: FC Jamison is on a distinguished road 
Solved Threads: 20
Team Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Can I use a template html page within another html page

 
0
  #7
Sep 2nd, 2006
The css should kick in once the page is written.

Give the banner image an id and write the css for it.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 57
Reputation: The Geeky Kid is an unknown quantity at this point 
Solved Threads: 1
The Geeky Kid's Avatar
The Geeky Kid The Geeky Kid is offline Offline
Junior Poster in Training

Re: Can I use a template html page within another html page

 
0
  #8
Sep 2nd, 2006
WHAT?!?! What happened to xndesiGns? Well, they basically gave a thing that I would've edited for you, PHP Include is barely PHP
Please help get my computers connected through an ethernet cord!
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 6
Reputation: Vicksley is an unknown quantity at this point 
Solved Threads: 0
Vicksley Vicksley is offline Offline
Newbie Poster

Re: Can I use a template html page within another html page

 
0
  #9
Sep 2nd, 2006
Originally Posted by Deacon J View Post
The css should kick in once the page is written.

Give the banner image an id and write the css for it.

Ahhhh......I must not be getting it .....actually it is doing the one thing I wanted.....Giving me the banner page across every page on the site....and giving me the one file to edit if I need to.....But I am thinking now javascript may not be what I am after as it still shows the page reloading around the same time that a normal html page does.....ie.as in flashing the banner rather than giving the affect of not moving at all...


I know I am not making much sense....but I know what I want to do....I just am not explaining it well enough......I just like to be difficult...and have it all work the way I want....and expect all to know what I am on about...lol

What I really wanted is the whole banner html page to load into the other html with all the content still in it....such as the banner Css and all the banner graphics that are attatched to the banner.html....

But I have a feeling that it wont all write into it.....

Dont worry...I will work it out....I wont sleep till I can get it right...LMAO...

Thanks Deac....Youve been a gem

Vick
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 50
Reputation: rus is an unknown quantity at this point 
Solved Threads: 0
rus's Avatar
rus rus is offline Offline
Junior Poster in Training

Re: Can I use a template html page within another html page

 
0
  #10
Sep 7th, 2006
The best way to do what you need is either with PHP if you are on a Linux server or ASP if you are on a WIN based server.

They both work in the same way, without using a database. You simply create your header/navigation as a seperate file. Then in each of your pages you place the include code where you want the header/nav to appear.

This is the broad explanation of how it works, but hopfully it will lead you in the right direction. There are tons of tutorials online that will tell you exactly how to do this.

Good luck!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC