How to make the same code change across multiple pages?

Hi there,

I’m coding a site right now, and it’ll have quite a few pages. Later, I can see myself wanting to make changes to code across all pages.

I guess Dreamweaver templates would be an option, but is there any different approach of how to make changes across the whole site while developing it?

It’s all just plain HTML pages.

Many thanks.

I recommend you check out ‘includes’. They are very simple but very powerful, and are perfect in this scenario. Forget about Dw templates. They are from hell. :slight_smile:

Hmmm, that doesn’t sound bad. Your link gives including menus as an example. Good point, would be really useful to include menu as a single file. But I tend to add class=“current” to menu items to highlight the current page within the menu. How would I handle this, or would I not use PHP include then?

Good point, but there’s an easy solution for that. Here’s what I do:

  • as an example, on the Home page I add a class on the <body> tag like class=“home”.
<body class="home">

Then in your menu, you would have something like

<li class="home"><a href="/">Home</a></li>

Now, in your CSS, use the “current” style like so:

.home li.home a {current styles}

So in the end, I’d have styles like this for each page section, so on the body tag of the Blog I’d have

<body class="blog">

and the CSS would look like this:

.home li.home a, .blog li.blog a {current styles}

I’ve just activated PHP on my mac, and it works great!

THat’s what I thought! :wink: