943,840 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Sep 1st, 2006
0

Can I use a template html page within another html page

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Vicksley is offline Offline
6 posts
since Aug 2006
Sep 1st, 2006
0

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

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.
Team Colleague
Reputation Points: 92
Solved Threads: 21
Posting Pro in Training
FC Jamison is offline Offline
436 posts
since Jun 2004
Sep 1st, 2006
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Vicksley is offline Offline
6 posts
since Aug 2006
Sep 1st, 2006
0

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

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
Reputation Points: 13
Solved Threads: 2
Junior Poster in Training
The Geeky Kid is offline Offline
57 posts
since Aug 2006
Sep 1st, 2006
0

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

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.
Team Colleague
Reputation Points: 92
Solved Threads: 21
Posting Pro in Training
FC Jamison is offline Offline
436 posts
since Jun 2004
Sep 2nd, 2006
0

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

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....
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Vicksley is offline Offline
6 posts
since Aug 2006
Sep 2nd, 2006
0

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

The css should kick in once the page is written.

Give the banner image an id and write the css for it.
Team Colleague
Reputation Points: 92
Solved Threads: 21
Posting Pro in Training
FC Jamison is offline Offline
436 posts
since Jun 2004
Sep 2nd, 2006
0

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

WHAT?!?! What happened to xndesiGns? Well, they basically gave a thing that I would've edited for you, PHP Include is barely PHP
Reputation Points: 13
Solved Threads: 2
Junior Poster in Training
The Geeky Kid is offline Offline
57 posts
since Aug 2006
Sep 2nd, 2006
0

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

Click to Expand / Collapse  Quote originally posted by Deacon J ...
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Vicksley is offline Offline
6 posts
since Aug 2006
Sep 7th, 2006
0

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

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!
rus
Reputation Points: 11
Solved Threads: 1
Junior Poster in Training
rus is offline Offline
50 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Site Layout and Usability Forum Timeline: Spry Menu not working in IE
Next Thread in Site Layout and Usability Forum Timeline: Site Redesign evaluation please





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC