Difficulty:Easy

Version:Expression Engine 1.0: 20040424

Buy My Book!

Update July 2008: If you like these tutorials and would like to read more like these, except updated for ExpressionEngine 1.6 and with tons more information, tips, tricks and recommendations, check out my new book, Building Websites with ExpressionEngine 1.6. Available either directly from Packtpub.com or from your local online bookstore (such as Amazon), this book uses the same clear, step-by-step approach found in these tutorials and walks you from the basics of installing ExpressionEngine to everything you need to know to have an ExpressionEngine website you can be proud of. (No prior knowledge of ExpressionEngine assumed).

The toasty website after this tutorial is complete, following path A!
The toasty website after this tutorial is complete, following path B!
The toasty website after this tutorial is complete, following path C!

Right now, you should have a CSS file and a HTML page. Things are looking good. This tutorial is going to show you how to write a second HTML page, using the same stylesheet. Don't feel limited to just 2 pages though: this tutorial is as equally applicable to your 2nd page as your 52nd page. That said, the next tutorial will show you how to make writing HTML pages far easier with the use of weblog data container. So, if you do have 50-odd pages to write, hold on to your horses...

Background Information

Most websites you visit will have a consistent look and feel. Most of the pages will look similiar, they’ll use the same colour scheme, they’ll have their logo and their footer on every page and so on.

In the last tutorial, we wrote a CSS page that was designed to style a basic HTML page. This time, we want to write a 2nd HTML page that shares the same look and feel as the 1st. Cor blimey, why not use the same CSS file then?

And that’s precisely what we do. Because our CSS file is stored in its own template, we can re-use the CSS file again and again. 1 page or 100 pages - it makes no difference. In fact, because you’re reusing the same file time and time again, your visitors only need to download once - speeding up your page response times as well.

Instructions

It makes sense to keep HTML and CSS files that are related within the same template group...

Add a new template...

Unlike many applications, selecting the template you want to duplicate does not automatically mean the radio button is selected. Therefore, be sure you check the radio button, or a blank template will be created...

Duplicate an existing template

Edit your new template

If you didn't "duplicate" a template, you can always just copy and paste code from one template to another. Edit the template you want to copy, highlight all the text and press CTRL-C, then go to the blank template you want to paste into, and press CTRL-V.

<head>

<title>Toast!</title>

<title>History of Toast</title>

<link rel='stylesheet' type='text/css' media='all' href='{stylesheet=site/css}' />


Change any text you like

My altered text

Edit your css file

If you want to create a different style for your other headings, you can just follow the h2 model but rename it for h3 (or whatever heading you're restyling).

h2

h2, h3

{


The headings that match!

body

{

margin-left: 5%;

margin-right: 5%;

background: #fff url('http://www.leoandmeg.com/images/toasty.jpg') no-repeat-y top center;

}


Got something to add? Add your comment to the 5 already made

Written by Leo and Meg on Saturday 8th May 2004