Go to main entry page of Dennis Bareis' Site (lots of free software, commented links and information) PPWIZARD ADVANCED/EXAMPLES Go to main entry page of Dennis Bareis' Site (lots of free software, commented links and information)
Have your say! Click here to join the PPWIZARD discussion list! No question too simple or too complex.

This page demonstrates some ppwizard features from basic to quite advanced. This includes SQL and CSV importing.

----------

EXAMPLE - SIMPLE BEGINNING

PPWIZARD allows you to name things, these items (if required in more than one html page) would typically be placed into a separate "header" file which all pages include.

Assume we have the following lines in the file "HEADER.IH":

    ;--- Some web addresses -----------------------------------------------------
    #define HttpMagazineOs2Ezine         http://www.os2ezine.com
    #define HttpOs2SuperSiteMainPage     http://www.os2warp.be/index2.php
    
    ;--- Set up some common styles ----------------------------------------------
    #define Red               <FONT COLOR=RED>{$Text}</FONT>
    #define Grün              <FONT COLOR=GREEN>{$Text}</FONT> ;;Note international characters can be used in names
    #define Bold              <B>{$Text}</B>
    #define Quote             &#147;{$Text}&#148;              ;;Pretty double quotes

The you could refer to the header definitions in one of your pages with:

    ;--- Include the file that contains common definitions ----------------------
    #include "header.ih"
    
    <P>Back issues of the <$Bold Text="e-Zine!"> magazines at
    <A HREF="<$HttpMagazineOs2Ezine>"><$HttpMagazineOs2Ezine></A> have articles
    on PPWIZARD.

Note that there is a single place to make a change if the site moves, you don't have to hunt through all your html files.

It is no accident that the #include, #define and other PPWIZARD have pretty much the same syntax as as that used for the 'C' language. This allows header files to be shared. I share PPWIZARD header files between 'C', rexx, html and CGI programs (for example for common html headers and footers).

Being able to do basic manipulation of html effectively on the 'client' side can improve overall server performance. The basic functions of PPWIZARD can frequently do the same things that a lot of people use Server Side Includes (SSI) and CGI code to solve. Note that for more advanced functionality nothing will beat server side coding - but why use it unless you have to? PPWIZARD can be run (and is being run) on the server using its /CGI mode however you'd need to examine its performance in this environment.

----------

EXAMPLE - IMPORT COMMA SEPARATED FILE

Assume that we have a file called "PPWEXAMP.CSV" which has been produced by Microsoft's EXCEL or 123 (possibly manually produced or via some VbScript):

    db0@bnz.com,Dennis Bareis,http://www.labyrinth.net.au/~dbareis/index.htm
    fred@any.com,Fred Nerk,http://www.fred.com
    another@any.com,Another Guy,http://www.another.com
    

Then with the following code you could import the file and generate a HTML table:

    #import "PPWEXAMP.CSV" CMA "" "Email<BR>Address" "Name" "Home<BR>Page"

You would get the following table generated:

Email
Address
NameHome
Page
db0@bnz.comDennis Bareishttp://www.labyrinth.net.au/~dbareis/index.htm
fred@any.comFred Nerkhttp://www.fred.com
another@any.comAnother Guyhttp://www.another.com

The above has a completely default look and feel, you have full control over exactly how it looks. To obtain a slight fancier and reorganised table (columns swapped) you could use:

    #define IMPORT_TABLE_ATTRIBS   BORDERCOLOR=BLUE BORDER=3 CELLSPACING=0 CELLPADDING=5
    #define IMPORT_HEADING_COLUMNS ALIGN=CENTER BGCOLOR=CYAN
    #import "PPWEXAMP.CSV" CMA "" "{2}Email<BR>Address" "{1}Name" "Home<BR>Page"

The following generated table has cyan heading and fields reordered:

NameEmail
Address
Home
Page
Dennis Bareisdb0@bnz.comhttp://www.labyrinth.net.au/~dbareis/index.htm
Fred Nerkfred@any.comhttp://www.fred.com
Another Guyanother@any.comhttp://www.another.com

To drop the email address field and make the home page address a hypertext link you could use:

    #define IMPORT_HEADING_COLUMNS ALIGN=CENTER BGCOLOR=CYAN
    #define IMPORT_RECORD          <TR><TD ALIGN=CENTER>{$Column1}</TD><TD ALIGN=CENTER><A HREF="{$Column2}" TARGET=_top>{$Column2}</A></TD></TR>
    #import "PPWEXAMP.CSV" CMA "" "" "Name" "Home<BR>Page"

The new table looks like:

NameHome
Page
Dennis Bareishttp://www.labyrinth.net.au/~dbareis/index.htm
Fred Nerkhttp://www.fred.com
Another Guyhttp://www.another.com

As you can see from the above it is fairly simple to perform some quite complex table setups including the dropping or reordering of fields. For more complex requirements (or to define your own import format) you can make use of macros. You can also automatically modify table entries such that "High" gets converted to "H" etc. For more complex requirements you can program what you require.

Another point I should make is that you are not restricted to HTML tables, if you were generating an OS/2 IPF file you could generate an IPF table, or in fact for all file types you don't need to generate a table at all (the HTML table is simply the default format).

You might have noticed the use of a "#define" in the above code, if you were preprocessing "C" code this would probably be an issue to you as you would probably not want PPWIZARD to process standard header files such as "stdio.h". PPWIZARD has many options which allow it to get out of the way in all of its processing, for example you can make PPWIZARD use the "!include" command and ignore "#include".

----------

EXAMPLE - IMPORT SQL DATABASES

PPWIZARD can import SQL as easily as it does the CSV formatted files shown above, the main difference is that instead of specifying a filename you need to specify an SQL query.

This example is accessing a Microsoft Access 2000 database under Windows 2000 using ODBC. SQL importing (using the #import command) is supported under all Windows versions, OS/2 as well as Unix and across a large number of databases.

    ;--- Specify the query (this determines the rows and their columns) ---------
    #define IMPORT_SQL_QUERY                                   \
            SELECT * FROM [FullDetails]                        \
            WHERE DeptSeqNo > 4  and DeptSeqNo < 11            \
            ORDER BY Department.DepartmentDescription
    
    ;--- Perform the SQL import -------------------------------------------------
    #define IMPORT_SQL_DATABASE   PHASE2
    #import "" SQL ""                                              \
            "{DepartmentDescription}Department's<BR>Description"   \
            "{DeptSeqNo}Department<BR>Sequence<BR>Number"

There are a lot of options not shown above (no userid or password was required to access the database etc). The #import command can handle some quite complex requirements however even if your requirements exceed what the command can handle nothing prevents you accessing the SQL database directly (the ppwizard manual demonstrates this).

----------

EXAMPLE - COMPLEX MACRO

This example shows how I simplify some of my photo pages, I do not need to know image sizes etc although I do want my generated HTML to contain them for improved browser performance. The image sizes are obtained from local copies I maintain (the source), my macro knows where they are. The macro has been written in a way that allows you to specify an alternative size if you wish to.

The following code defines a photo macro (could be done in separate header file) and then creates a table and uses the macro:

    ;--- Photo macro will either use passed size or work out correct size for you ---
    #define Photo                                                            \
            ;--- Where is file on local file system? ----------------------  \
            #evaluate+  LocalFileName    ^"..\graphics\{$Image}"^            \
                                                                             \
            ;--- The output depends on this image -------------------------  \
            #DependsOn  INPUT            "<$LocalFileName>"                  \
                                                                             \
            ;--- Start a new table row ------------------------------------  \
            <TR>                                                             \
                                                                             \
            ;--- If user did not pass the size then work it out -----------  \
            #if "{$Size=''}" <> ""                                           \
                #define+   TmpSize {$Size}       ;;User told us size         \
            #elseif                                                          \
                #evaluate+ TmpSize ^GetImageHeightWidth("<$LocalFileName>")^ \
            #endif                                                           \
                                                                             \
            ;--- Generate some code ---------------------------------------  \
            <TD ALIGN=CENTER>                                                \
            <IMG SRC="graphics/clear1x1.gif" WIDTH=1 HEIGHT=1 VSPACE=20>     \
            {$Title}<BR><BR>                                                 \
            <IMG SRC="graphics/{$Image}" BORDER=0 <$TmpSize> ALT="{$Title}"> \
            <IMG SRC="graphics/clear1x1.gif" WIDTH=1 HEIGHT=1 VSPACE=20>     \
            </TD>                                                            \
            </TR>
    
    ;--- Start the table --------------------------------------------------------
    <BR><CENTER><TABLE COLS=1 BORDER=10 CELLSPACING=10>
       <TR>
       <TH ALIGN=CENTER>Pictures
       </TR>
    
       ;--- Use the macro to generate photo cells -------------------------------
       <$Photo Image="dbareis.jpg"  Title="Me hard at work">
       <$Photo Image="kpaw_ff.jpg"  Title="Kangaroo Paws along Front Fence">
    
    ;--- Complete table ---------------------------------------------------------
    </TABLE></CENTER>

The following table is generated by the above code:


Pictures
Me hard at work

Me hard at work
Kangaroo Paws along Front Fence

Kangaroo Paws along Front Fence

----------

EXAMPLE - SOME OF THIS PAGES SOURCE CODE

I will show you some of the main files for this page. I do not pretend that what you will see is the best way to do something, it's just here to give you a better idea of what can be done. Note that I use the "ExtHTTP" macro to ensure that the version of my web pages that I install on my work's intranet have no external links.

This is a header file "HTMLPRE.IH" (comes with PPWIZARD) that allows me to automatically include real working code as an example on this page (note that not all of its features are used by this page):

    ;----------------------------------------------------------------------------
    ;     MODULE NAME:   HTMLPRE.IH
    ;
    ;         $Author:   USER "Dennis"  $
    ;       $Revision:   1.0  $
    ;           $Date:   14 Oct 2002 17:50:00  $
    ;        $Logfile:   C:/DBAREIS/Projects.PVCS/PpwAddOn/HtmlPRE/htmlpre.ih.pvcs  $
    ;
    ;     DESCRIPTION:   This is a header file for handling inclusion of
    ;                    "examples" into HTML.
    ;
    ;                    See PPWIZARD documentation for examples of this file
    ;                    in use.  The sample "TryMe.IT" file also uses this
    ;                    header file.
    ;
    ;
    ;                    Macro "ExampleFile"
    ;                    ~~~~~~~~~~~~~~~~~~~
    ;
    ;                    This macro takes the following parameters:
    ;
    ;                         FILE
    ;                         ~~~~
    ;                         Manditory. Identifies the file to be included.
    ;
    ;                         FRAGMENT
    ;                         ~~~~~~~~
    ;                         Optional. You may wish to have a single example
    ;                         file hold more than one example.  The text that
    ;                         you supply for this parameter marks the line before
    ;                         as well as the line after the example.
    ;
    ;
    ;                         INDENT
    ;                         ~~~~~~
    ;                         Optional.  By default a 4 space indent is used,
    ;                         you specify the number of spaces with 0 being
    ;                         valid.
    ;
    ;                         STATE
    ;                         ~~~~~
    ;                         Optional.  By default no autotagging will be
    ;                         performed.  If you specify "REMEMBER" then the
    ;                         currently available autotags will be used, you
    ;                         may also specify which states tags should come
    ;                         from (see the "#AutoTagState +" command).
    ;
    ;
    ;                         ASIS
    ;                         ~~~~
    ;                         Optional.  By default only basic "AsIs" tagging
    ;                         is performed.  If for example you wished to
    ;                         handle international characters then you would
    ;                         need to specify the names of the AsIs tags to use.
    ;
    ;
    ;
    ;                    Macro "Example / eExample"
    ;                    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    ;
    ;                    Note that your "inline" example code is terminated by
    ;                    a "eExample" macro where the "Example" part is in the
    ;                    EXACT case that you used. This allows the example code
    ;                    itself to contain the string "eExample" as long as it
    ;                    is in a different case.
    ;
    ;                    This macro takes the following parameters:
    ;
    ;
    ;                         INDENT
    ;                         ~~~~~~
    ;                         As above.
    ;
    ;                         STATE
    ;                         ~~~~~
    ;                         As above.
    ;
    ;
    ;                         ASIS
    ;                         ~~~~
    ;                         As above.
    ;
    ;
    ;
    ;----------------------------------------------------------------------------
    
    
    ;--- Define the version number of this header file --------------------------
    #ifdef    VERSION_HTMLPRE_IH
        ;--- Only include the file once! ---
        #EOF 1
    #endif
    #define   VERSION_HTMLPRE_IH    03.238
    #require  02.001
    
    
    ;--- Define some aliases for characters we need to be careful with ----------
    #RexxVar  "LT"   =x= "&lt;"               ;;'<' Char
    #RexxVar  "GT"   =x= "&gt;"               ;;'>' Char
    #RexxVar  "AMP"  =x= "&amp;"              ;;'&' Char
    #RexxVar  "HASH" =x= "#"                  ;;'#' Char
    
    
    ;--- Did user already define the way examples are tagged (start & end)? -----
    #ifndef ExampleFormatted
       ;--- Define look and feel of examples ------------------------------------
       #ifndef HTMLPRE_JUST_PRE_TAGS
               ;--- Set up defaults that user can override ----------------------
               #define? HTMLPRE_COLOR          purple
               #define? HTMLPRE_STYLE_OTHER    ;font-size:80%
    
               ;--- Set up the tags ---------------------------------------------
               #define ExampleFormatted                                               \
                       <FONT COLOR=<$HTMLPRE_COLOR>> ;;Set up font (older browsers)  -\
                       <PRE STYLE="color:<$HTMLPRE_COLOR><$HTMLPRE_STYLE_OTHER>">
               #define eExampleFormatted                                              \
                       </PRE>                                                        -\
                       </FONT>                       ;;Restore Font (older browsers)
       #elseif
           ;--- Either want default "PRE" look or will define via stylesheet ----
           #define ExampleFormatted                                           \
                   <pre>                             ;;Start Example
           #define eExampleFormatted                                          \
                   </pre>                            ;;End of Example
       #endif
    #endif
    
    
    ;--- Set up AsIs Mode (minimum changes required - user can add to these) ----
    #AutoTagState +
       ;--- Define characters that should be automatically modified -------------
       #AutoTag   "<"   "<?xLT>"
       #AutoTag   ">"   "<?xGT>"
       #AutoTag   "&"   "<?xAMP>"
       #AutoTag   "#"   "<?xHASH>"
    
       ;--- "PROGRAM" ASIS mode -------------------------------------------------
       #AsIs  SETUP    HTMLPRE_IH
    #AutoTagState -
    
    
    ;----------------------------------------------------------------------------
    ;--- ALLOW SPELL CHECKING IN EXAMPLES? --------------------------------------
    ;----------------------------------------------------------------------------
    #ifndef HTMLPRE_SPELL_CHECKING
            #define HTMLPRE_SPELL_CHECKING OFF
    #endif
    
    
    ;----------------------------------------------------------------------------
    ;--- EXAMPLE FILE INCLUSION -------------------------------------------------
    ;----------------------------------------------------------------------------
    #( ''
       #define ExampleFile
       <$ExampleFormatted>
       #AutoTagState  +     {$STATE=''}      ;;User can set up own tags
       #NextId        PUSH   ;;Don't want #Nextid processing!
       #option        PUSH AllowSpell={$SPELL="<$HTMLPRE_SPELL_CHECKING>"} ExtraIndent=^copies(' ', {$Indent='4'})^
       #AutoTag        ON
       #AsIs          ON HTMLPRE_IH {$AsIs=''}
       #include       "{$File}" "{$Fragment=''}"
       #AsIs          OFF
       #option        POP
       #NextId        POP
       #AutoTagState  -
       <$eExampleFormatted>
    #)
    
    
    
    ;----------------------------------------------------------------------------
    ;--- EXAMPLE (INLINE) -------------------------------------------------------
    ;----------------------------------------------------------------------------
    #( ''
       #define Example
       ;--- Starts Example ------------------------------------------------------
       <$ExampleFormatted>
       #AutoTagState  +     {$STATE=''}    ;;User can set up own tags
       #NextId        PUSH   ;;Don't want #Nextid processing!
       #option        PUSH AllowSpell={$SPELL="<$HTMLPRE_SPELL_CHECKING>"} ExtraIndent=^copies(' ', {$Indent='4'})^
       #option        PUSH replace=OFF
       #AutoTag        '<?xLT>$e{$?MacName}<?xGT>'  '<$e{$?MacName}>'  #1
       #option        POP                  ;;Restore REPLACE mode
       #AutoTag        ON
       #AsIs          ON HTMLPRE_IH {$AsIs=''}
       #define        HTMLPRE_INLINE_EXAMPLE
    #)
    #( ''
       ;--- Ends Example --------------------------------------------------------
       #define /Example
       #ifndef        HTMLPRE_INLINE_EXAMPLE
           #error ^Incorrectly formatted inline example (can't include end of example tag)^
       #endif
       #AsIs          OFF
       #option        POP
       #NextId        POP
       #AutoTagState  -
       #undef         HTMLPRE_INLINE_EXAMPLE
       <$eExampleFormatted>
    #)
    #define eExample <$/Example>           ;;Map old macro name to new

This is the source for "PPWIZARD.IH" common header used by 2 versions of the html page you are now viewing:

    #ifndef Title
            #define  Title     \
                     HTML Preprocessor. PPWIZARD includes external files, templates
    #endif
    
    #define  FULL_DESCRIPTION  PPWIZARD is a free programable HTML preprocessor. \
                               Multiplatform, imports SQL, Excel etc.            \
                               Allows template/style sheet design.               \
                               Site automation and ensures common                \
                               look and feel for all your pages.
    
    #define  FULL_KEYWORDS     html preprocessor, preprocessor,                  \
                               preprocesser, html preprocesser,                  \
                               include external file,                            \
                               include html file in html file,                   \
                               ipf preprocessor, rexx preprocessor,              \
                               generater, generates, generator,                  \
                               macro, macros, symbol, symbols, variable,         \
                               cgi, ssi, asp, rexx, ipf, ipfc,                   \
                               pre-processor, pre-processer, hand code,          \
                               maintenance,                                      \
                               preprocessing,                                    \
                               substitution, replace, replacement,               \
                               template, pattern,                                \
                               boilerplate, boiler, plate, boiler plate,         \
                               reuse, define, declare,                           \
                               include, imbed fragment, component,               \
                               import,                                           \
                               conditional, selective, export,                   \
                               free, freeware, shareware,                        \
                               header, footer, definitions,                      \
                               windows, dos, linux, unix, warp, os/2,            \
                               htmlpp, orb, htp, Hitop
    
    ;**      CommentBlock  /* (Thursday 19/10/2000, 18:30:18, by USER "Dennis") */
    ;**+--------------------------------------------------------------------------
    ;**|#define  FULL_KEYWORDS     html, preprocessor, html preprocessor,            \
    ;**|                           preprocesser, html preprocesser,                  \
    ;**|                           ipf preprocessor, rexx preprocessor,              \
    ;**|                           generater, generates, generator,                  \
    ;**|                           macro, macros, symbol, symbols, variable,         \
    ;**|                           cgi, ssi, asp, rexx, ipf, ipfc,                   \
    ;**|                           pre-processor, pre-processer, hand code,          \
    ;**|                           maintenance,                                      \
    ;**|                           nest, file include, include file,                 \
    ;**|                           inclusion, automate, automation, automatic,       \
    ;**|                           predefined, symbolic, preprocessing,              \
    ;**|                           substitution, replace, replacement,               \
    ;**|                           template, pattern,                                \
    ;**|                           boilerplate, boiler, plate, boiler plate,         \
    ;**|                           reuse, define, declare,                           \
    ;**|                           include, imbed fragment, component,               \
    ;**|                           import, #include, #define, #if, #import,          \
    ;**|                           web, database, sql,                               \
    ;**|                           conditional, selective, export,                   \
    ;**|                           free, freeware, shareware,                        \
    ;**|                           header, footer, common, definitions,              \
    ;**|;;                         content, management, content management,          \
    ;**|                           dos, linux, unix, warp, os/2,                     \
    ;**|                           windows,  windows 95, windows 98, windows nt,     \
    ;**|                           nt, w32,                                          \
    ;**|                           2000, win2000, w2000, win 2000, windows 2000,     \
    ;**|                           w2k, windows w2k, win2k,                          \
    ;**|                           htmlpp, orb, htp,                                 \
    ;**|                           xhtml,                                            \
    ;**|                           web, ipf, inf, asp, xml, xsl, dtd,
    ;**|;;                           directive, directives
    ;**|
    ;**+--------------------------------------------------------------------------
    ;**                    /* (Thursday 19/10/2000, 18:30:18, by USER "Dennis") */
    
    #OneLine
    #define P_HAND_CODE
            <P>PPWIZARD can be particularly useful for people who like
            to hand code their html and use a html editor.
            The use of a GUI based editor does not however rule out
            PPWIZARD's use and some editors allow you to define your
            own tags (allowing you to add ppwizards tags and commands).
    #OneLineEnd
    
    
    
    ;--- Some general definitions -----------------------------------------------
    #define ImgLargePpwizard                 <IMG SRC="graphics/ppwiz1.jpg" HSPACE=10 ALIGN=middle WIDTH=302 HEIGHT=85 BORDER=0 ALT="{$ALT=^PPWIZARD graphic^}">
    #define HREF_feedback                    ppwizard/bugs_or_suggestions.htm
    #define HREF_orb2ppw                     ppwizard/orb2ppw.htm
    
    
    #define OtherPpwizardPages                                         \
            <$ImgBarbedWire>                                          -\
            <CENTER><H2>Other Interesting Pages</H2></CENTER>         -\
            <P>Some other ppwizard pages you might be interested in:  %\
            #include "PPWLINKS.IH"
    
    #(
        #define JoinPpwizardList
        <$ExtHttp
            HTTPURL='tech.groups.yahoo.com/group/PPWIZARD/join'
            VISIBLE='<img src="graphics/ppwizardforum.gif" border=0 width=124 height=39 HSPACE=10
                     ALIGN={$Align='middle'}
                     alt="Have your say! Click here to join the PPWIZARD discussion list! No question too simple or too complex.">'>
    #)
    #( ''
        #define JoinPpwizardListRightAligned
        <?NewLine><?NewLine>
        <TABLE ALIGN={$Align='right'} COLS=1 cellSpacing=0 cellPadding=2 border=0>
           <?NewLine>
           <TR>
               <TD align=middle>
                    #include "PayPal.IH"
                    <$DonateWithPayPal FOR="PPWIZARD">
               </TD>
           </TR>
           <?NewLine>
           <TR>
               <TD>
                  <$JoinPpwizardList>
               </TD>
           </TR>
        </TABLE>
        <?NewLine><?NewLine>
    #)
    
    ;**    [CommentBlockStart     (August 17, 2005 8:24:34 PM EST, Dennis)
    ;**+----------------------------------------------------------------------
    ;**|#define JoinPpwizardList      \
    ;**|        <$ExtHttp HTTPURL='tech.groups.yahoo.com/group/PPWIZARD/join' VISIBLE='<img src="graphics/yahoogrp.gif" border=0 width=91 height=52 HSPACE=10 ALIGN=middle alt="Have your say! Click here to join the PPWIZARD discussion list! No question too simple or too complex.">'>
    ;**|;**      CommentBlock  /* (Thursday 01/02/2001, 19:43:36, by USER "Dennis") */
    ;**+----------------------------------------------------------------------
    ;**    CommentBlockEnd]       (August 17, 2005 8:24:34 PM EST, Dennis)
    
    
    #include "ppwzdstr.ih"
    #define  COUNTER_ID        1369242     ;;PPWIZARD counter
    #include "counter.ih"
    #include "computer.ih"
    

This is the source for this page:

    #include "ppwizard.ih"
    #define  HTMLPRE_STYLE_OTHER
    #include "HTMLPRE.IH"
    
    ;--- Title ------------------------------------------------------------------
    <$BackgroundMainWindows>
    <$PageTitle TITLE=^PPWIZARD ADVANCED/EXAMPLES^>
    <$JoinPpwizardListRightAligned>
    
    <P>This page demonstrates some ppwizard features from basic to
    quite advanced.
    This includes SQL and CSV importing.
    
    ;--- These "dangerous" characters are used in examples on this page ---------
    #AutoTag   "ü"      "&uuml;"
    #AsIs      SETUP   DANGEROUS
    
    
    ;##############################################################################
    ;### Automatically link examples to online doco. This gets a little bit     ###
    ;### complicated because of some of the automatic filename generation that  ###
    ;### occurred during the generation of the doco as well as the fact that    ###
    ;### a '#' is 'invalid' in a URL filename.                                  ###
    ;##############################################################################
    #define  ExampleLinkToPpw#Same                                          \
             #evaluate+ '' ^PpwUrl = ToLowerCase("ppwizard/{$Name}.htm")^  -\
             <A HREF="<??PpwUrl>">{$Name}</A>
    #define  ExampleLinkToPpw#Cmd                                                                                \
             #if '{$Url=''}' <> ''                                                                              -\
                 #RexxVar PpwUrl = 'ppwizard/{$Url}.htm'                                                        -\
             #elseif                                                                                            -\
                 #evaluate+ '' ^PpwUrl = ToLowerCase("ppwizard/hash" || strip(substr('{$CMD}', 9)) || ".htm")^  -\
             #endif                                                                                             -\
             <A HREF="<??PpwUrl>">{$CMD}</A>    ;;Generate link
    #AutoTag  "<?xHASH>AsIs"              ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>import"            ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>evaluate"          ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>AutoTag "          ^<$ExampleLinkToPpw#Cmd CMD="{$AT}"> ^
    #AutoTag  "<?xHASH>AutoTagState"      ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>include"           ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>define"            ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>undef"             ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>option"            ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>RexxVar"           ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>info"              ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>ifndef"            ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>elseif"            ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>endif"             ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>error"             ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>break"             ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>DependsOn"         ^<$ExampleLinkToPpw#Cmd CMD="{$AT}">^
    #AutoTag  "<?xHASH>{"                 ^<$ExampleLinkToPpw#Cmd CMD="{$AT}" URL="loopstart">^
    #AutoTag  "<?xHASH>}"                 ^<$ExampleLinkToPpw#Cmd CMD="{$AT}" URL="loopend">^
    #AutoTag  "<?xHASH>if "               ^<$ExampleLinkToPpw#Cmd CMD="<?xHASH>if"> ^
    #AutoTag  "ToLowerCase"               ^<$ExampleLinkToPpw#Same NAME="{$AT}">^
    #AutoTag  "GetImageHeightWidth"       ^<$ExampleLinkToPpw#Same NAME="{$AT}">^
    #AutoTag  "ExtraIndent"               ^<$ExampleLinkToPpw#Same NAME="{$AT}">^
    
    
    
    ;##############################################################################
    ;##############################################################################
    ;##############################################################################
    <$ImgBarbedWire>
    <CENTER><H2>EXAMPLE - SIMPLE BEGINNING</H2></CENTER>
    
    <P>PPWIZARD allows you to <$Bold Text="name"> things, these items (if required
    in more than one html page) would typically be placed into a separate "header"
    file which all pages include.
    
    <P>Assume we have the following lines in the file "HEADER.IH":
    <$ExampleFile STATE="REMEMBER" FILE="PPWEXAMP.IH" FRAGMENT="SimpleStartHeader" AsIs=^DANGEROUS^>
    
    <P>The you could refer to the header definitions in one of your pages with:
    <$ExampleFile STATE="REMEMBER" FILE="PPWEXAMP.IH" FRAGMENT="SimpleStartCode">
    
    <P>Note that there is a single place to make a change if the site moves, you
    don't have to hunt through all your html files.
    
    <P>It is no accident that the #include, #define and other PPWIZARD have
    pretty much the same syntax as as that used for the 'C' language.  This
    allows header files to be shared.  I share PPWIZARD header files between
    'C', rexx, html and CGI programs (for example for common html headers and
    footers).
    
    <P>Being able to do basic manipulation of html effectively on the 'client'
    side can improve overall server performance.  The basic functions of
    PPWIZARD can frequently do the same things that a lot of people use
    Server Side Includes (SSI) and CGI code to solve.  Note that for more
    advanced functionality nothing will beat server side coding - but why use
    it unless you have to?  PPWIZARD can be run (and is being run) on the
    server using its /CGI mode however you'd need to examine its performance
    in this environment.
    
    
    
    ;##############################################################################
    ;##############################################################################
    ;##############################################################################
    <$ImgBarbedWire>
    <CENTER><H2>EXAMPLE - IMPORT COMMA SEPARATED FILE</H2></CENTER>
    
    <P>Assume that we have a file called "PPWEXAMP.CSV" which has been produced
    by Microsoft's EXCEL or 123 (possibly manually produced or via
    some VbScript):
    
    <$ExampleFile STATE="REMEMBER" FILE="PPWEXAMP.CSV">
    
    <P>Then with the following code you could
    <A HREF="ppwizard/hashimport.htm">import</A> the file and generate a
    HTML table:
    <$ExampleFile STATE="REMEMBER" FILE="PPWEXAMP.IH" FRAGMENT="AllDefaultTable">
    
    <P>You would get the following table generated:
    <P>
    #include "PPWEXAMP.IH" "AllDefaultTable"
    
    
    <P>The above has a completely default look and feel, you have full
    control over exactly how it looks.
    To obtain a slight fancier and reorganised table (columns swapped)
    you could use:
    <$ExampleFile STATE="REMEMBER" FILE="PPWEXAMP.IH" FRAGMENT="FancierTable">
    
    <P>The following generated table has cyan heading and fields reordered:<P>
    #include "PPWEXAMP.IH" "FancierTable"
    
    
    <P>To drop the email address field and make the home page address a
    hypertext link you could use:
    <$ExampleFile STATE="REMEMBER" FILE="PPWEXAMP.IH" FRAGMENT="FancierTableWithLinks">
    
    <P>The new table looks like:<P>
    #undef   IMPORT_HEADING_COLUMNS
    #undef   IMPORT_TABLE_ATTRIBS
    #include "PPWEXAMP.IH" "FancierTableWithLinks"
    
    <BR>
    <P>As you can see from the above it is fairly simple to perform some quite
    complex table setups including the dropping or reordering of fields.  For
    more complex requirements (or to define your own import format) you can make
    use of
    <A HREF="ppwizard/macros.htm">macros</A>.
    You can also automatically modify table entries such that "High" gets
    converted to "H" etc.
    For more complex requirements you can program what you require.
    
    <P>Another point I should make is that you are not restricted to HTML
    tables, if you were generating an OS/2 IPF file you could generate an IPF
    table, or in fact for all file types you don't need to generate a table at
    all (the HTML table is simply the default format).
    
    <P>You might have noticed the use of a "#define" in the above code, if you
    were preprocessing "C" code this would probably be an issue to you as you
    would probably not want PPWIZARD to process standard header files such as
    "stdio.h". PPWIZARD has many
    <A HREF="ppwizard/hashoption.htm">options</A> which allow it to get out
    of the way in all of
    its processing, for example you can make PPWIZARD use the "!include"
    command and ignore "#include".
    
    
    
    
    
    ;##############################################################################
    ;##############################################################################
    ;##############################################################################
    <$ImgBarbedWire>
    <CENTER><H2>EXAMPLE - IMPORT SQL DATABASES</H2></CENTER>
    
    <P>PPWIZARD can import SQL as easily as it does the CSV
    formatted files shown above, the main difference is that instead
    of specifying a filename you need to specify an SQL query.
    
    <P>This example is accessing a Microsoft Access 2000 database under
    Windows 2000 using ODBC.
    SQL importing (using the #import command) is supported under all Windows
    versions, OS/2 as well as Unix and across a large number of databases.
    
    <$ExampleFile STATE="REMEMBER" FILE="PPWEXAMP.IH" FRAGMENT="[MsAccessImport]">
    
    <P>There are a lot of options not shown above
    (no userid or password was required to access the database etc).
    The #import command can handle some quite complex requirements however
    even if your requirements exceed what the command can handle nothing
    prevents you accessing the SQL database directly
    (the ppwizard manual demonstrates this).
    
    
    
    
    
    ;##############################################################################
    ;##############################################################################
    ;##############################################################################
    <$ImgBarbedWire>
    <CENTER><H2>EXAMPLE - COMPLEX MACRO</H2></CENTER>
    
    <P>This example shows how I simplify some of my photo pages, I do not need
    to know image sizes etc although I do want my generated HTML to contain them
    for improved browser performance.  The image sizes are obtained from local
    copies I maintain (the source), my
    <A HREF="ppwizard/macros.htm">macro</A>
    knows where they are.  The macro
    has been written in a way that allows you to specify an alternative size
    if you wish to.
    
    
    <P>The following code defines a photo macro (could be done in separate
    header file) and then creates a table and uses the macro:
    <$ExampleFile STATE="REMEMBER" FILE="PPWEXAMP.IH" FRAGMENT="PhotoExample">
    
    <P>The following table is generated by the above code:<P>
    #include "PPWEXAMP.IH" "PhotoExample"
    
    
    
    
    ;##############################################################################
    ;##############################################################################
    ;##############################################################################
    <$ImgBarbedWire>
    <CENTER><H2>EXAMPLE - SOME OF THIS PAGES SOURCE CODE</H2></CENTER>
    
    <P>I will show you some of the main files for this page.  I do not pretend
    that what you will see is the best way to do something, it's just here to give
    you a better idea of what can be done.  Note that I use the "ExtHTTP" macro
    to ensure that the version of my web pages that I install on my work's
    intranet have no external links.
    
    <P>This is a header file "HTMLPRE.IH" (comes with PPWIZARD) that allows
    me to automatically include real working code as an example on this page
    (note that not all of its features are used by this page):
    <$ExampleFile STATE="REMEMBER" FILE="HTMLPRE.IH">
    
    <HR COLOR=RED NOSHADE SIZE=1>
    <P>This is the source for "PPWIZARD.IH" common header used by 2 versions of
    the html page you are now  viewing:
    <$ExampleFile STATE="REMEMBER" FILE="PPWIZARD.IH" AsIs=^DANGEROUS^>
    
    ;--- Show this html pages source --------------------------------------------
    <HR COLOR=RED NOSHADE SIZE=1>
    <P>This is the source for this page:
    <$ExampleFile STATE="REMEMBER" FILE="PPWEXAMP.IT" AsIs=^DANGEROUS^>
    
    ;--- Thats All --------------------------------------------------------------
    <$OtherPpwizardPages>
    <$EndHtmlWithStandardFooter>

----------

Other Interesting Pages

Some other ppwizard pages you might be interested in:
The Editor: To say I'm spectacularly amazed at how well this works is an understatement. Figuring out how to use it wasn't too difficult, in fact, the new OS/2 eZine is based on one sample from the documentation.
Extract of Yippee's Review: Fortunately, for all the effort PPWizard requires it is a hugely flexible and powerful utility that can be of great use to serious web authors everywhere. Recommended.
Highest rating at NONAGS
Highest rating - Editor's Pick!



Made with my FREE PPWIZARD program (HTML preprocessor). Create MAINTAINABLE sites using templates. My site contains over 600 pages.
Unframe "ppwexamp.htm"

Friday July 11 2014 at 7:16pm
Made with my FREE PPWIZARD program (HTML preprocessor). Create MAINTAINABLE sites using templates. My site contains over 600 pages.