constant / universal navigation

They have: 1 posts

Joined: Jan 2006

I usually design all my web pages by hand coding HTML so forgive me if this is a really dumb question ... I'm a beginner to Dreamweaver. On each of my web sites, some part of every web page is constant, specificaly the header, the navigation links on the left, and the ad on the right. On a web site with 50 subpages, when I want to add one more link to the navigation on the left, I have to manually edit every sub page. Or, for example, if I wanted to change the ad on the right, I have to do it on all 50 sub pages. Is there an easier way? I want a way for me to only have to edit the constant part of my web pages once and have it change on all of my other web pages, like it does if I edit something in my template in Blogger and republish.

Can anyone nicely point me in the right direction? Thanks.

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Ideally, if you're dealing with a site that has 10+ page, you'd want a host that can provide you with a server side language - such as PHP. This way, you only need to edit one page and the rest of them will be updated.

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

You could use an 'include' so that you only need edit one page but then on all of the other pages into which you code the include it would automatically show the updates.

Julia - if life was meant to be easy Michael Angelo would have painted the floor....

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

There are a couple of ways you can do this in Dreamweaver. You could look into using the Dreamweaver templates functionality to keep your constant elements in a template that you would only need to edit once when a change needs to be made. Check their help area for more on how to use that. I tried using templates years ago but I found myself getting frustrated with them quite quickly (although that was somewhere around version 3 or 4 so it might be better in the newer ones).

You can also use an "include" as Julia mentioned. There are two ways of doing this. Server Side Includes (SSI) is one way, but I found that Dreamweaver had trouble with that (also a few versions ago). I've had more success in Dreamweaver using PHP for includes. I'm sure someone can post the code for that - I don't have it handy here. That would mean that your pages would need to have a PHP extension and you would have to have php support on the server.

Welcome to TWF!

demonhale's picture

He has: 3,278 posts

Joined: May 2005

As explained on an include, you can use a different php file for your menus like for example menu.php ... then on your actual pages (which should be php or html read as php) you put the include command

<?php
include "menu.php";
?>

So everytime you update your menu.php file, all php files that contain the include will have an updated menu system.

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

And if you don't have PHP capabilities, you could always include an external JavaScript file. If there's any way to do PHP (or any other server side language) instead, though, jump on it. JavaScript is dependant on several things on the web surfer's computer, and therefor not recommended when you can avoid it.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.