•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Site Layout and Usability section within the Web Development category of DaniWeb, a massive community of 392,080 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,040 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Site Layout and Usability advertiser:
Views: 5672 | Replies: 18
![]() |
It's actually pretty simple. I found a good tutorial that will help:
http://www.tizag.com/phpT/include.php
http://www.tizag.com/phpT/include.php
•
•
•
•
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?
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.
In other words, remove all tags before Body and after /Body except any JavaScript that controls mouse over, etc.
•
•
Join Date: Oct 2006
Location: Sofia, Bulgaria
Posts: 135
Reputation:
Rep Power: 2
Solved Threads: 7
•
•
•
•
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"> </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!
•
•
Join Date: Feb 2007
Location: Ukraine, Nikolaev
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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 and .
E.g.: I have the main page index.php with the code in it:
I use it in my own site. It's pretty simple and works. Minus - title of page is unchangable. But I coped with this.
Then I just found a PHP book and there are some appropriatable functions as guys have already said: they are
include
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.
•
•
Join Date: Apr 2007
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
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,
www.bryanregencia.com
web design | web usability | information architecture | CSS | XHTML
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,
www.bryanregencia.com
web design | web usability | information architecture | CSS | XHTML
•
•
Join Date: May 2007
Posts: 30
Reputation:
Rep Power: 2
Solved Threads: 2
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
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
Looking at my own code of Life and thinking what the hell is this....
------------------------------------
Middle East B2B Marketplace
Dubai Web Design
Dubai SEO
------------------------------------
Middle East B2B Marketplace
Dubai Web Design
Dubai SEO
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Site Layout and Usability Marketplace
- How to add tables in HTML page dynamically? (HTML and CSS)
- Open an html page from within flash flv? (Graphics and Multimedia)
- How To Hyperlink Normal HTML page with ASP.NET Page? (ASP.NET)
- Inserting (large) flash banner in HTML page (HTML and CSS)
- Print HTML page / download updates (VB.NET)
- PHP in a html page? (PHP)
- Calling function to add HTML to the page (ASP.NET)
Other Threads in the Site Layout and Usability Forum
- Previous Thread: FTP error in Dreamweaver
- Next Thread: How do i load a image on the same page ?


Linear Mode