Introduction to PPWIZARD, Part 2



By: Walter Metcalf
Date: 11/24/99

Last week we briefly introduced PPWizard, one of the most unusual and powerful aids to writing HTML documents available. This week we'll continue the series with a tutorial on using PPWizard to write an actual document.

For the purposes of this tutorial, I am going to show you how to use PPWizard macros and other features to create the article I wrote on 10 November 1999 about Judge Jackson's Findings of Fact in the DOJ vs. Microsoft trial.

Templates

  1. "Templates" in PPWizard terminology are files that you load into your editor and then add to according to your needs.

  2. The article began with a template that looks something like this:

    Article Template
      
    #define Title
    #define Keywords
    #define Date
    #define NextWeekTopic
    #define TalkBack
    
    #include "i:\ppw\macros\macros.ih"
    
    <$FeatureHeader>
    <P>
    Dateline: <$Date>
    <P>
    <P>
    <$FeatureEnd>
     

  3. The first group of statements--starting with "#define"--define variables according to:

    1. Title
      • The document title that appears in the browser title and in the META Description line.

    2. Keywords
      • The words and phrases that are used to seed the META Keyword line for the benefit of search engines.

    3. Date
      • The document date that appears in the browser title line and in the "Dateline" field.

    4. NextWeekTopic
      • The text that appears under the "Next Week" image at the bottom of the article.

    5. TalkBack
      • The discussion ID in the Delphi Forum where you are invited to post your ideas on this topic.

  4. Header Files

    1. Header Files have an extension of ".ih" and become part of your program for compilation purposes but do not actually appear in your editor file.

      1. Typically they contain variable or macro definitions, etc.

      2. In this case the only Header File used is Macro.ih, which contains all the general purpose macros I use.

    2. Macro.ih contains several macros which together make up the standard beginning and standard ending of a feature. Click here to see those macros. Note that the variables Title, Keywords, etc. that were defined at the beginning of the template are picked up by the macros FeatureHeader and FeatureEnd, and inserted in the correct place in the HTML code.

    3. The macros and variables defined in a Header File are available for use in all lines of your programs after the #include statement containing the Header File name.

  5. Body

    • The main text, or body, of the article is placed between "Dateline" and <FeatureEnd>.

  6. FeatureEnd

    • Like FeatureHeader, FeatureHead contains macros and other definitions to handle the routine text that occurs at the end of each article.

  7. Talkback Macro

    1. We'll go into more detail on macros next week, but as an interesting example on how variables can be used to construct more complex expressions, let's look at the Talkback variable, which is simply defined as a decimal number (e.g. 304.2).

      1. View the file 'MacroFeature.txt' and look for the third line under the line "#define FeatureEnd". You'll see the two lines:

        <P><$InLine HTTP="about.delphi.com/
        ab-<$SITE_ALIAS>/start/?msg=<$TalkBack>"

        Desc="Talk Back"> to me with your questions and comments.

      2. ....$InLine.... is a call to a macro I wrote with two mandatory parameters: HTTP, the URL, and Desc, the description displayed by the browser. SITE_ALIAS is a predefined variable equal to this site ID, OS2.

      3. Now we are ready to see the result of the expansion of the macro InLine as used here:

      4. As many of you know already, simply clicking on that link takes you directly to the discussion about PPWizard that's already underway. Once the macro is set up, all I have to do is determine the correct number and enter it at the top of the article template. That gives you a some idea of the power of macros in PPWizard.

    2. Now that I whetted your appetite, I hope you'll come back next week when I'll show you the nuts and bolts of writing some actual macros.

Walter Metcalf

Next week: Introduction to PPWIZARD, Part 3


Unless otherwise noted, all content on this site is Copyright © 2004, VOICE