943,607 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Sep 7th, 2006
0

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

Yeah...without some type of server-side programming, the only way I know of to do that is with frames.
Team Colleague
Reputation Points: 92
Solved Threads: 21
Posting Pro in Training
FC Jamison is offline Offline
436 posts
since Jun 2004
Sep 7th, 2006
0

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

It's actually pretty simple. I found a good tutorial that will help:
http://www.tizag.com/phpT/include.php
rus
Reputation Points: 11
Solved Threads: 1
Junior Poster in Training
rus is offline Offline
50 posts
since Dec 2004
Sep 7th, 2006
0

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

Click to Expand / Collapse  Quote originally posted by rus ...
It's actually pretty simple. I found a good tutorial that will help:
http://www.tizag.com/phpT/include.php
That does look pretty simple...

...and this doesn't reload the menu.php file every time a new page is loaded?
Team Colleague
Reputation Points: 92
Solved Threads: 21
Posting Pro in Training
FC Jamison is offline Offline
436 posts
since Jun 2004
Sep 7th, 2006
0

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

I'm not an expert, but I don't think it does. One thing it doesn't make clear is that the file that you want included should be stripped of the all tags except what is needed to format the page. So the example they show you would remove the HTML and BODY tags.
In other words, remove all tags before Body and after /Body except any JavaScript that controls mouse over, etc.
rus
Reputation Points: 11
Solved Threads: 1
Junior Poster in Training
rus is offline Offline
50 posts
since Dec 2004
Oct 27th, 2006
0

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

Click to Expand / Collapse  Quote originally posted by Vicksley ...
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
Hi there.
All solutions for your problem listed below seem to be OK, however, the easiest way to do it is using css. If the banner you want to place shows the same way on every page, you should just make something like this :

<div id="banner">&nbsp;</div>
and add the following css to an external file
#banner {
width=banner width;
height=banner height;
background-image: src"path/to/your/banner.jpg";
backgrount-repeat: no repeat;
}
then just copy the <div> element on every of your pages.

The second way is to create a template in dreamweaver. Dreamweaver has its own template engine, so once you setup your template and apply it to all of your pages, once you change the template, all your pages will update.

If you don't know how to do a template, there is a tutorial in Dreamweaver and it is really good and simple.

The last option is using javascript or php to set it up, however I see that other guys have already explained it.
Good luck!
Reputation Points: 21
Solved Threads: 26
Posting Whiz in Training
Rhyan is offline Offline
240 posts
since Oct 2006
Oct 30th, 2006
0

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

Thanks...

But I have done all that...using css...

nevermind......what I was tryin to acheive I think I need to use php....but dont want to.....lol

So...I will just stick to the css I think.....

thanks anyhow...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Vicksley is offline Offline
6 posts
since Aug 2006
Feb 11th, 2007
0

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

Hi! I had the same problem sometime ago.
Then I just found a PHP book and there are some appropriatable functions as guys have already said: they are
include
and
readFile
.

E.g.: I have the main page index.php with the code in it:
<?php
 if (empty($c)) {
    readFile("a.htm");
    } else {
    readFile("$c");
} ?>

I use it in my own site. It's pretty simple and works. Minus - title of page is unchangable. But I coped with this.
Shu
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Shu is offline Offline
4 posts
since Feb 2007
May 1st, 2007
0

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

Hey guys,

Here is a PHP solution for that from Alistapart, check this link: http://www.alistapart.com/articles/keepingcurrent/

This is not just for navigation. PHP include or require_once function can also be used to insert external HTML file (code of your navigation, footer, banner, etc.) in your markup. With this, updating menus, footer, banner, etc. in your pages can be done by just editing one file -- no database, no javascript, only simple PHP function and HTML. Hope this would help.

Your web design buddy,
web design | web usability | information architecture | CSS | XHTML
Last edited by Ezzaral; Jul 1st, 2009 at 7:12 pm. Reason: Snipped sig link. Please see the rules on this.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
webdesign buddy is offline Offline
9 posts
since Apr 2007
May 9th, 2007
0

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

Hi,

why don't you try JavaScript and XML..

Put your all content in xml file then load this xml file through javascript where you want on your page.

Look for some tutorial how to read xml file you will get lots of resources....

Cheers
Reputation Points: 10
Solved Threads: 2
Light Poster
azzu5 is offline Offline
30 posts
since May 2007
Jul 1st, 2009
0

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

hi, thanks for the suggestion. Can you please give more details on the code you have provided. Can you show a sample page how we can use it.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Tonupunuri is offline Offline
1 posts
since Jul 2009

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