of interest

PPWIZARD

Contents

 

PPWIZARD is a very powerful generic text preprocessor that runs on pretty much any OS. Visit the PPWIZARD home page at http://www.labyrinth.net.au/~dbareis/ppw_simp.htm.

 

1. Using PPWIZARD to manage code

1.1. Defining re-usable code

PPWIZARD can be used to efficiently build and maintain websites as it allows the division of code into reusable 'chunks', eliminating duplication and redundancy while developing and updating the code of a site.

For example, every page on this site uses the same code in the header, which is stored in a single definition in a header file called 'code.ih':

#define PageXHTMLHeader                                                           \
   <?xml version="1.0" encoding="{$encoding}"?>                                   \
   <!DOCTYPE HTML PUBLIC                                                          \
      "-//W3C//DTD XHTML 1.0 Transitional//EN"                                    \
      "ttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>                  \
   <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$lang}" lang="{$lang}">  \
   <head>                                                                         \
   <meta http-equiv="Content-Language" content="{$locale}" />                     \
   <meta http-equiv="Content-Type" content="text/html; charset={$encoding}"/>     \
   <meta name="keywords" content="{$keywords}" />                                 \
   <meta name="description" content="{$description}" />                           \
   <title>{$title}</title>                                                        \
   <link rel="stylesheet" type="text/css" href="{$stylesheet}" />                 \
   </head>

PPWIZARD '#define' example

1.2. Implementation

This is then implemented in each page with:

#include "code.ih"
<$PageXHTMLHeader lang="en" \
                  locale="en-us" \
                  encoding="utf-8" \
                  keywords="tarafain.com, tarafain" \
                  description="The **coolest** site ever" \
                  title="tarafain.com" \
                  stylesheet="./styles.css">

PPWIZARD variable usage example

 

You then compile the source. This can be done by using a context-menu shortcut (right-click in Windows) or more efficiently from a command line or batch file:

 

PPWIZARD index.it /Output:_final_output\*.html

 

This particular example will process index.it and output the file to a subdirectory called _final_output with an .html extension.

 

Finally, just run the file(s) through HTML TIDY and you've got clean XHTML.

PPWIZARD - Page 1

[ contents ]     [ next -->