Chapter 17

Using Your Own HTML Code


CONTENTS

FrontPage contains a lot of built-in features that make your Web designing tasks a lot easier. You need only edit the HTML code in your pages when you choose to, for the most part, which makes this chapter nice and brief. No doubt, you've peeked behind the scenes and studied the code that FrontPage generates for you automatically. You feel you really have a handle on things and want to get your hands on the code to fine-tune it and tweak it a little. You have some HTML code that was generated by your external development tools, and you want to insert it into your FrontPage-generated Web pages. Although FrontPage has a lot of tags, attributes, and values built in to the FrontPage Editor, sometimes you need to add others.

FrontPage allows you to add code into your pages in a couple of ways. One solution is to use the View | HTML command, which opens a color-coded HTML editor. There, you can modify the code that FrontPage generates without going through the dialog boxes to modify the code. Another solution is to use the HTML Markup bot, which allows you to add HTML code that FrontPage does not directly support and bypasses FrontPage's code-checking features.

When the FrontPage Features Aren't Enough

The Web is like the weather: Wait five minutes and it will change. As a result, it's hard for browser and Web page editing software programmers to predict what features they'll need to incorporate in their software. It's one of the reasons FrontPage gives you a couple of ways to add extensibility. For many tags, you can add extended features by using extended attributes. You've covered those already in previous chapters. However, for those tags that aren't covered in the FrontPage Editor, you can use the HTML Markup bot or the View | HTML command to enter code manually.

Using the View or Edit HTML Window

When you want to view or edit your HTML code, choose the View | HTML command in the FrontPage Editor. The View or Edit HTML window, shown in Figure 17.1, appears. This editor is a color-coded HTML editor, where HTML tags are displayed in purple, attributes are displayed in blue, attribute values are displayed in green, and page content is displayed in black. You can disable the color coding, if you prefer, by unchecking the Show Color Coding option located at the bottom of the View or Edit HTML window.

Figure 17.1 : The View or Edit HTML window is a color-coded HTML editor from which you can modify your HTML code.

The View or Edit HTML window allows you to view your code in two ways:

Original. To view your code as it appeared when you first opened the page in the FrontPage Editor, choose the Original radio button from the bottom of the View or Edit HTML window.
Current. To view your current HTML code, select the Current radio button at the bottom of the View or Edit HTML window. This is the default selection when you first open the HTML editor.

From this View or Edit HTML window, you can add or modify any code that you choose. Some find it quicker to modify settings from this window, rather than re-enter settings in the FrontPage dialog boxes. You can also use copy (Ctrl+C) and paste (Ctrl+V) commands to copy code from other HTML editors and insert it into the View or Edit HTML window. When you are finished editing the code, choose OK to return to the WYSIWYG FrontPage Editor.

What happens if you insert code that the FrontPage Editor does not directly support? FrontPage 97 fields the code, and it handles the situation automatically for you. When you return to the FrontPage Editor, you see small yellow rectangles on your page with question marks in them. These are HTML Markup bots, which are covered in the next task.

Using the HTML Markup Bot

What the HTML Markup bot does is allow you to enter "snippets" of code that the FrontPage Editor doesn't write itself. The code that is contained in HTML Markup bots is not checked for accuracy. FrontPage lets you do the thinking there and figures you've got it right.

The HTML Markup bot is really quite simple to use. Here's basically what you do:

  1. Create as much as you can in the FrontPage Editor. After all, it's easy to use, and you can get a good idea of what your page layout looks like.
  2. Position the insertion point where you want to add additional features by using code.
  3. Choose Insert | WebBot Component and then choose HTML Markup. The HTML Markup WebBot dialog box, shown in Figure 17.2, appears.
    Figure 17.2 : Insert HTML code into your page with the HTML Markup WebBot dialog box.

  4. Enter the code you want to include on the page in the HTML Markup dialog box, or cut and paste it from other editors.
  5. Choose OK. FrontPage then inserts the code into your Web page. What you see on the FrontPage Editor screen is a small yellow rectangle with a question mark.
  6. To edit the code in the HTML Markup bot, all you have to do is double-click that small yellow icon. The HTML Markup WebBot dialog box opens again, and you can edit your code.

TIP
It's a good idea to also use the Insert | Comment command somewhere near the HTML Markup bot to add a comment that describes the Markup bot's contents. This gives you a quick visual reminder of why the Markup bot is there.

Make It Easy: Create Snippet Pages

If you find you use the same markups over and over again, create a page that places all your HTML Markup bot icons in one place. Use a Comment (Insert | Comment) or text to describe the contents of each of the markups. Save the page in your Web's _private directory so your Web's table of contents won't list the page. To insert the markup into another page, simply highlight the icon you want to reuse, copy it into your clipboard, and paste it into another page.

Editing Framesets

Frames are designed with the Frames Wizard. If you try to edit the page in the FrontPage Editor, the Frames Wizard opens again so you can edit the frame's configuration. The FrontPage Editor has the majority of the frame tags built in. Internet Explorer 3.0 supports the capability to display additional attributes for frames that really enhance the appearance of your framesets. These attributes are as follows:

At present, there's no way to add extended attributes to framesets from the Frames Wizard. In addition, because the frameset page automatically opens in the frameset, you can't use HTML Markup bots or the View or Edit HTML window to edit the code.

If you really want to use either of the tags mentioned previously to enhance your framesets, there is a workaround method. Open the page from the FrontPage Explorer as follows:

  1. From any view in the FrontPage Explorer, click the frameset you want to edit to select it.
  2. Right-click and choose Open With from the pop-up menu. The Open with Editor dialog box appears.
  3. Select the text editor that you have configured in FrontPage. FrontPage uses Notepad for a text editor by default. I prefer using WordPad, because it offers search and replace capabilities that Notepad doesn't offer.
  4. Near the beginning of the page, you see each frame described in a line beginning with the following text:
    <frame src=
    In the following code example, frame borders of all four frames are set to No, and five pixels of spacing are added around the frames. You see this code added to the frame descriptions at the end of each of the lines:
    <frameset cols="15%,70%,15%">
    <frame src="csnav.htm" name="csnav"
    åframeborder="No" framespacing="5">
    <frameset rows="13%,87%">
    <frame src="clpgtoc.htm" name="cssect"
    åframeborder="No" framespacing="5">
    <frame src="cooltoc.htm" name="csmain"
    åframeborder="No" framespacing="5">
    </frameset>
    <frame src="csout.htm" name="csout"
    åframeborder="No" framespacing="5">
    <noframes>
  5. After you make your modifications, choose File | Save to save the new page. FrontPage adds the new file to the Import list and then automatically imports the revised file into your web. The result is a nice, clean-looking frameset that, when viewed in Internet Explorer 3.0, looks similar to that shown in Figure 17.3.
    Figure 17.3 : The frameset borders have been turned off in your HTML code, giving the frameset a much cleaner appearance.

Unfortunately, this nicer appearance comes at a price. When you use this procedure, you break the connection with the Frames Wizard, so if you want to edit your frameset in the future, you need to make the changes manually. In addition, you now actually have two copies of your alternate content page in your web-the one you originally made and a code version of it that is now contained in your broken frameset. It's easy to see that these two versions can get out of sync.

Here's a workaround for the workaround. You can rebuild your frameset page a little further by using an Include bot to place the contents of your original alternate content page into this broken frameset.

TIP
If you feel more comfortable about testing this out on a copy of your frameset page, open the frameset in the FrontPage Editor and choose File | Save As. Save a backup copy of the frameset to your web under a different filename.

To add your alternate content page into an Include bot, follow these steps:

  1. From the FrontPage Editor, choose File | Open (Ctrl+O), or use the Open command to open your frameset page. Now, instead of invoking the Frames Wizard, you see what looks like your alternate content page appear in the FrontPage Editor, as shown in Figure 17.4.
    Figure 17.4 : When you open the frameset in the FrontPage Editor now, you see what looks like your alternate content page.

  2. Choose Edit | Select All (Ctrl+A) and press the Delete key. Yes, that's right; delete the contents of the whole page. You're going to use an Include bot to put it all back in again.
  3. Choose Insert | Web Bot Component. The Insert WebBot Component dialog box appears. Highlight Include and choose OK. The WebBot Include Component Properties dialog box appears.
  4. Use the Browse button to locate the page that you originally specified for your frameset's alternate content page in your current web. Highlight the page and choose OK to place the Include bot on your page. Now, your frameset and your alternate content page are in sync again. You can make changes to your alternate content page without worrying about fixing its code in your broken frameset as well.
  5. Save the page to your web using the File | Save command.
  6. To test your page, choose File | Preview in Browser. First, choose a browser that supports framesets to see if the frameset appears OK. After that, use the File | Preview in Browser command again with a browser that does not support framesets. You see your alternate content page. If everything appears correctly, your repair job is done.

Workshop Wrap-Up

Now you know where you can find the tools to manually edit the code that FrontPage generates for you automatically. Using the View or Edit HTML window and the HTML Markup bots, you can add code and features that go beyond the capabilities of the FrontPage Editor. You also learned how you can enhance the appearance of framesets, giving your frames a much cleaner appearance.

Next Steps

In the next chapter, you'll combine what you learned in this section to add more pages to your My World Web. You'll complete your page templates, add additional content pages, and create the frameset for your web.

Q&A

Q:What you're saying is it's actually best to do as much as I can in the FrontPage Editor and then add the rest in with the HTML Markup bot or the View or Edit HTML window?
A:I find it to be the simplest way, but you might learn different tips and tricks as you become more familiar with entering your own code. If you can see what you get while you're working on it, why not use that to your advantage while you develop your page?
Q:When I import pages from other sites into the FrontPage Editor, sometimes it inserts a whole series of HTML Markup bots, one right after the other. Can I combine them all together?
A:If there's no other content between them, I don't see why not. What you can do is open the second HTML Markup bot and copy its contents into your clipboard. Then, open the first one and paste the contents of your clipboard at the end of its contents. Continue on down the line in this manner, pasting the contents of the third to the first, and so on. Delete all but the first Markup bot, which combines the content of all of them.
Q:If there are a whole bunch of Markup bots scattered around the page, can I put them all in one place?
A:Probably not. Remember, you might have content in between them, and the Markup bot tags are usually arranged in the order in which your code has to appear to make the page flow correctly.