Creating Pages from your Template

By this time you should have your template page looking the way that you want your web pages to look - apart from the actual content which will be different for each page and which is still just represented by the filler text. The next step then is to actually copy the template file and start replacing the rest of the filler text with the individual content for each page.

To start creating a new web page the first thing that you need to do is to open the template.html file in NVU. The next thing that you should do immediately and without fail is to select File and then Save As and save the file using the actual filename that you want the page you are about to create to have. Doing the Save As at this point means that you are now working on the real web page using its correct name. If you were to leave the Save As step until later in the edit process and accidentally selected to Save instead you would overwrite your carefully created template page with the current page content which we do not want to do.

To replace the main filler text with your actual content we van use the same methods that we have already used for updating headings, links and images to update any remaining elements of those types that need to have specific content for each page. The one part of our page content where we need to do things a little differently is with the main part of our content where we may have already applied formatting such as paragraphs and lists in whichever text editor we used to write the content in the first place.

Whatever you do for copying and pasting your content from one editor to the other, do not copy directly from Microsoft Word or Wordpad into NVU. When you copy from either of those programs Microsoft assumes that the content may eventually need to be pasted back into Word and will surround the content with a huge mass of pseudo HTML codes whose sole purpose is to rebuild the original Word document. You do not want to copy that code into your web page, you want the content with appropriate correct HTML markup. Open Office does not have this same problem so if you have a copy of Open Office and open your Word document there then you can copy and paste the paragraph and list content directly from Open Office into NVU and the appropriate paragraph and list tags will be inserted around your content. There may be a few unnecessary attributes and elements added such as inline font styling and empty paragraphs between all of the actual paragraphs but these minor additions to the HTML are insignificant compared to what you get copying from Word or Wordpad. If you are familiar with HTML then it will be a trivial matter to switch NVU into Source Mode and delete those surplus attributes and empty paragraphs.

If you don't have Open Office then the safest thing to do with your Word or Wordpad file is to save it as a .txt file and then open it in Notepad. Unfortunately, if you just paste the entire content into NVU from there you will get the entire content surrounded by a span and will have two line break characters between what are supposed to be paragraphs instead of having the paragraphs properly enclosed in paragraph elements.

To avoid having that happen we'll copy the content one paragraph at a time instead of copying the entire content in one go. So for each paragraph to be copied we need to carry out the following steps.

  1. Copy the paragraph content from Notepad
  2. Paste the paragraph into NVU where you want it to go.
  3. Select the content you just pasted.
  4. From the Format menu select Paragraph and change the content from Body Text to Paragraph

Copying each paragraph of content like this will be slightly slower than any method of copying the entire content in one go but does have the advantage that the only HTML markup that we end up with is what is supposed to be there instead of having a small amount of redundant markup (as happens if you copy in bulk from Open Office) or a huge amount of garbage (as happens if you copy in bulk from Word or Wordpad).


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow