Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating a new template

From: Dreamweaver CS5 Essential Training

Video: Creating a new template

Creating templates is a two-step process. First, you save the file as a template, and then you create its editable regions. When a file is first saved as a template, everything on the page is initially locked down. Without defining editable regions you wouldn't be able to build any new pages using your template. In this movie, we're going to take the source file that we created in our last movie, save it as a template, and then go in and define all those editable regions that we're going to need for our pages.

Creating a new template

Creating templates is a two-step process. First, you save the file as a template, and then you create its editable regions. When a file is first saved as a template, everything on the page is initially locked down. Without defining editable regions you wouldn't be able to build any new pages using your template. In this movie, we're going to take the source file that we created in our last movie, save it as a template, and then go in and define all those editable regions that we're going to need for our pages.

So, I'm going to go over to my Files panel and I have defined the 13_02 folder as my root directory. And I'm going to go in and find the main_template.htm. So here is the page that we structured last time. You can see all the placeholders we placed in, Region ID, breadcrumb, Page Heading, and notice that as we click in the links, they all have that baseLink class applied to it. So baseLink has been applied to all those and finally remember in our trivia, we have that trivia body section down there.

So this page is ready to go and we're ready to make a template out of it. So what we're going to do here is go to File and choose Save as Template. Now you don't have to have a page that's fully structured to save as a template. It doesn't really matter. You can take a fully finished page and save it as template, or you can start from scratch. Whichever workflow is going to be faster for the type of site that you're creating. So, I'm going to choose Save as Template. Now, you're going to see something little different here. We don't get to browse to a directory. We just get this dialog box that comes up and says Save as Template.

It asks us which site we want to save it to. In this case, Explore California. It also shows us that currently we don't have any templates in our site. So we can go ahead and save this page as anything we want, but there is a reason that we named it main_template. That is the name that I want for this template, so I'm just going to leave that name as it is. Now, it's always helpful to type in a description for your template, especially if you're going to have multiple templates. So, I'm just going to call this one top level Explore California template.

So, a brief description that describes the type of pages that should be created using that template is a good idea. I'm going to go ahead and hit Save. It's going to ask you if you want to Update Links. Definitely say Yes. Now, let's take a look at why. If you look over your Files panel, we have a folder over there that we didn't have before. This Templates folder was just created and if we look inside of it, we can see the template that we just created, main_template.dwt. Dreamweaver templates use the .dwt extension.

Now, this Templates directory is a very important directory. You don't want to move this around, change it, and delete it, anything like that. Dreamweaver is going to reference the files in this directory for all the pages that you build off the templates. So, it's really important that this remains on the root and that you don't modify it in any way. Now, when you go to upload your pages, you do not need to upload this to your site in order for it to work. Templates really only apply to the local development environment and aren't required by the remote server in order to work properly. Okay, so now that we have our template, the next thing we need to do is go through and add some editable regions.

If we just saved our template right now and closed it and try developing pages off of it, we could build pages, but we wouldn't be able to change anything because everything would automatically be locked down. Creating an editable region is really just as simple as highlighting the regions that you want to be able to change in your template pages and making an editable region out of them. Now, there are a couple of things you have to take into consideration when you're creating a new editable region. Let's create our first one and we'll talk about some of those. Go ahead and highlight the text Region ID.

That's going to change on every single page, so we need to make an editable region out of that. So with that highlighted, I'm going to go up to my menu and go to Insert > Template Objects > Editable Region. Note the keyboard shortcut, Ctrl+Alt+V or Command+Option+V on the Mac. If you're going to be doing a lot of template creation, that's a good keyboard shortcut to know. So, Insert > Template Objects > Editable Region and we're going to be prompted to go ahead and name this. All editable regions have to have a unique name, so we're going to call this one regionID.

I want to make sure that follows your standard naming convention, single word. You can use underscores or Camel Case naming or whatever your personal preference is. I'm going to go ahead and click OK, and there is our first editable region. Now, notice that the editable region is surrounded in sort of this blue outline and kind of has a blue tab. You can change the color- coding on those if you'd like. Locked regions have one color and editable regions have another, but if you're going to change them, you can do that through the preferences. If you're in a team, make sure everybody is using the same color, because you don't want to confuse people if you're using one color for editable regions, and another for locked.

Okay, so the editable region we just created is pretty unique and what we've done is we've created an editable region within a tag. So, our editable region now exists only within this h1 tag. You can see there is a little tag called mmtemplate:editable, and if we'll look at that in Code View or Split Screen View, you can see the Dreamweaver uses these comment tags to identify a template structure. So if you ever look at the code, you can see where editable regions begin and where they end. Well, this editable region is inside the heading.

That means that whoever creates pages based off this template won't be able to modify the heading at all, only the contents of the heading. That's a really big distinction. Do you want to give people the ability to change an entire region, or do you want to give them just the ability to change the text within a specific heading or paragraph? You've got the ability to narrow that focus, or you have the ability to create a really large area like we're about to do next. So, next we want the remainder of our main content area to be an editable region. Now our breadcrumbs will be inside an editable region, but they are also going to be part of something called an optional region, so we're going to be creating them just a little bit later as we tackle those.

Okay, so I want you to place your cursor just below the breadcrumbs and when you do that you'll probably click and select this div tag called mainArticle. Once you have that div tag selected-- an easier way to select it maybe would be to click inside of it and then choose the mainArticle-- you want to switch over to Code View. You want to make sure in Code View that you've lines 48 through 51 highlighted. You want the entire div tag highlighted. The reason that we're doing this is we want the entire div tag to be contained within an editable region. This way you could change that div tab, you could add tags underneath it, and you wouldn't be restricted to only changing the contents of the div tag, so that's very important.

I'm going to switch back to Design View. I'm going to go up to Insert > Template Objects > Editable Region and we're going to name this one mainContent. So now we have an area where our body copy and our page headlines can be entered into and also since we have the entire div tag as part of that editable region, we could add additional div tags afterwards if the page structure demanded that. Okay, let's scroll down and we're going to add our sidebar as an editable region and we're going to do that in a very similar fashion. Just go in and click anywhere inside the sidebar and then select the sidebar itself using the Tag Selector right there.

Now, for this one, we want all of our content within the sidebar to be editable, but we don't want the div tag itself to be inside of an editable region. So, sometimes the best way to do that is to go into Code View. So, I'm going to switch to Code View, and there I can see the beginning of the sidebar and I can see the end of the sidebar. So, what I'm going to do now is I'm going to start selecting at line 55 and I'm going to scroll all the way down to line 70. So make sure that you have the div "specials" highlighted, and the closing div on line 70 highlighted. But the ending div tag for the sidebar, which is on 71, and the beginning div tag for the sidebar, which is on 54, you don't want those highlighted, because we only want our editable region to be inside the sidebar div tag, not surrounding it.

So again, I'm going to go back up to my Design View and I'm going to go up to Insert > Template Objects > Editable Region, and we're going to just call this one sidebar. Now, it may seem like we were having to be extremely precise there and well, we were. When you create editable regions, you really need to think about the structure of the page and what portion of that region needs to be editable. Is it just a headline that needs to be editable? Is it an entire region or is it the contents of the div tag? When you go to make your editable region, you always want to double-check to make sure that you have the proper area highlighted.

Sometimes you might have too large of an area highlighted and sometimes too small of an area highlighted, and the best way to verify that is just to go into Code View, find out precisely which tags you have selected, and what portion of your page is going to be within that editable region. Taking the extra time to do that as you're creating your templates is very important because it's going to save you a tremendous amount of time a little bit later on. So now we have three initial editable regions. We have the regionID, the mainContent, and the sidebar. Go ahead and save your template and Dreamweaver is going to give you a little message. Now, this really isn't an error message. This is more of just letting you know.

Notice that it says "You placed the editable region "regionID" inside a block tag." That's the heading that we're talking about. "Users of this template will not be able to create new blocks in this region." Meaning you won't be able to add paragraphs or new headings up there. "Move this region outside the block tag if you want users to be able to do this." So in this instance we meant to do that, and we want that capability, but it's fantastic that Dreamweaver shows us this message because if that is not what we had intended, or maybe we selected too small of a region, Dreamweaver is going to give us that feedback so that we know, oh, I didn't mean to do that, I need to modify that editable region.

As it is, that's exactly what we wanted to do so we're going to go ahead and click OK. Now, every time we save this template we're going to be faced with that particular message. So, if it becomes annoying to you after a while, you could turn it off. I like leaving it on because it just gives me the confirmation that yes, indeed, I did select that area and that is what I meant to do. Or if I didn't mean to do that, it's always nice to have Dreamweaver reminding me of the fact that editable region might need to be changed. So now I'm going to go ahead and click OK. Now, we're almost done with creating our template, but if we take a moment to think about how we're going to build our pages, there are still two items that we need to be concerned with.

Our navigation needs to change to show that current page and either to hide or show the sub-navigation based on which section of the site we are in. We also need to either hide or display the breadcrumb navigation based upon the page that we're building. So, first we'll create a means of defining what current page we're on and what type of page we're building through the use of editable attributes. Then we'll move on to controlling the visibility of content through the use of optional regions.

Show transcript

This video is part of

Image for Dreamweaver CS5 Essential Training
Dreamweaver CS5 Essential Training

135 video lessons · 89034 viewers

James Williamson

Expand all | Collapse all
  1. 2m 57s
    1. Welcome
      1m 8s
    2. Using the exercise files
      1m 49s
  2. 7m 50s
    1. What is Dreamweaver?
      3m 16s
    2. Learning web design
      2m 22s
    3. Current web standards
      2m 12s
  3. 43m 9s
    1. The Welcome screen
      4m 5s
    2. Windows and Mac interface differences
      2m 23s
    3. The Application toolbar
      4m 7s
    4. The Document toolbar
      4m 40s
    5. Arranging panels
      8m 19s
    6. Managing workspaces
      7m 32s
    7. The Properties Inspector
      5m 54s
    8. The Insert panel
      6m 9s
  4. 25m 45s
    1. Basic site structure
      3m 11s
    2. File naming conventions
      1m 49s
    3. Defining a new site
      4m 35s
    4. Managing sites
      4m 51s
    5. Managing files and folders
      6m 36s
    6. Working with browsers
      4m 43s
  5. 27m 21s
    1. Creating new documents
      5m 16s
    2. New document preferences
      3m 6s
    3. Setting accessibility preferences
      4m 56s
    4. Working with starter pages
      3m 46s
    5. Managing starter pages
      10m 17s
  6. 30m 2s
    1. Basic tag structure
      2m 15s
    2. Adding structure to text
      8m 20s
    3. Creating lists
      9m 59s
    4. Getting text into Dreamweaver
      5m 59s
    5. Importing Word documents
      3m 29s
  7. 1h 17m
    1. Understanding style sheets
      2m 16s
    2. The anatomy of a CSS rule
      1m 48s
    3. Setting CSS preferences
      6m 36s
    4. The CSS Styles panel
      10m 2s
    5. Controlling CSS through the Properties Inspector
      5m 14s
    6. Using the Code Navigator
      7m 21s
    7. Using CSS Enable
      6m 45s
    8. Understanding element selectors
      8m 11s
    9. Understanding class selectors
      8m 49s
    10. Understanding ID selectors
      5m 59s
    11. Understanding descendant selectors
      6m 51s
    12. Attaching external style sheets
      7m 44s
  8. 1h 47m
    1. Working with units of measurement
      7m 11s
    2. Declaring font families
      9m 39s
    3. Controlling font sizing
      9m 9s
    4. Controlling weight and style
      8m 0s
    5. Controlling line height
      8m 29s
    6. Controlling vertical spacing with margins
      12m 3s
    7. Controlling spacing with padding
      5m 39s
    8. Aligning text
      8m 26s
    9. Transforming text
      5m 36s
    10. Writing global styles
      15m 42s
    11. Writing targeted styles
      17m 37s
  9. 1h 32m
    1. Understanding image types
      5m 3s
    2. Managing assets in Dreamweaver
      12m 51s
    3. Setting image accessibility preferences
      4m 20s
    4. Setting external image editing preferences
      3m 52s
    5. Placing images on the page
      7m 37s
    6. Photoshop integration
      5m 54s
    7. Modifying Smart Objects
      5m 51s
    8. Alternate Photoshop workflows
      8m 8s
    9. Modifying image properties
      11m 14s
    10. Styling images with CSS
      7m 11s
    11. Using background graphics
      9m 3s
    12. Positioning background graphics
      11m 6s
  10. 55m 16s
    1. Link basics
      3m 37s
    2. Setting site linking preferences
      2m 14s
    3. Creating links in Dreamweaver
      11m 1s
    4. Absolute links
      5m 8s
    5. Using named anchors
      11m 19s
    6. Linking to named anchors in external files
      2m 44s
    7. Creating an email link
      5m 24s
    8. Creating CSS-based rollovers
      13m 49s
  11. 1h 34m
    1. CSS structuring basics
      2m 56s
    2. The Box Model
      13m 21s
    3. Understanding floats
      6m 53s
    4. Clearing and containing floats
      8m 56s
    5. Using relative positioning
      4m 8s
    6. Using absolute positioning
      7m 18s
    7. Creating structure with div tags
      12m 7s
    8. Styling basic structure
      10m 34s
    9. Creating a two-column layout
      10m 37s
    10. Using Live View and CSS Inspect
      7m 51s
    11. Using Browser Lab
      9m 39s
  12. 56m 22s
    1. Reviewing table structure
      7m 41s
    2. Importing tabular data
      5m 13s
    3. Creating accessible tables
      9m 56s
    4. Using thead and tbody tags
      4m 0s
    5. Basic table styling
      8m 45s
    6. Styling table headers
      7m 52s
    7. Styling column groups
      4m 22s
    8. Creating custom table borders
      5m 1s
    9. Styling table captions
      3m 32s
  13. 1h 43m
    1. How forms work
      3m 0s
    2. Reviewing form design
      3m 2s
    3. Creating accessible forms
      7m 33s
    4. Setting form properties
      4m 6s
    5. The fieldset and legend tags
      4m 32s
    6. Inserting text fields
      5m 58s
    7. Inserting list menu items
      5m 26s
    8. Inserting checkboxes
      7m 50s
    9. Inserting radio button groups
      6m 22s
    10. Inserting text areas
      4m 12s
    11. Inserting submit buttons
      3m 37s
    12. Basic form styling
      12m 0s
    13. Form element styling
      8m 52s
    14. Styling form layout
      11m 49s
    15. Adding form interactivity
      2m 47s
    16. Using Spry validation widgets
      12m 49s
  14. 1h 23m
    1. Planning for templates
      10m 51s
    2. Creating a new template
      10m 37s
    3. Using editable attributes
      13m 43s
    4. Creating optional regions
      6m 23s
    5. Creating new pages from a template
      9m 17s
    6. Applying templates to existing pages
      6m 9s
    7. Working with nested templates
      7m 56s
    8. Working with repeating regions
      12m 58s
    9. Modifying templates
      5m 41s
  15. 40m 14s
    1. Behaviors overview
      3m 47s
    2. Hiding and showing elements
      9m 18s
    3. Spry overview
      4m 4s
    4. Using Spry widgets
      11m 36s
    5. Adding Spry effects
      3m 6s
    6. Using the Widget Browser
      8m 23s
  16. 28m 18s
    1. Inserting Flash files
      5m 4s
    2. Setting properties for Flash
      6m 27s
    3. Dreamweaver and Flash integration
      6m 6s
    4. Encoding Flash video
      6m 10s
    5. Adding Flash video
      4m 31s
  17. 45m 28s
    1. Running site-wide reports
      6m 33s
    2. Checking for broken links
      5m 41s
    3. Checking for browser compatibility
      8m 3s
    4. Adding remote servers
      8m 0s
    5. Uploading files
      7m 20s
    6. Managing remote sites
      9m 51s
  18. 34s
    1. Goodbye

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.

Mark all as unwatched Cancel


You have completed Dreamweaver CS5 Essential Training.

Return to your organization's learning portal to continue training, or close this page.

Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?


Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.