Code Pastie ID: 1000 (Edit or View CSS/HTML)
program rapid; {$mode objfpc}{$H+}

uses
  pwinit, pwmain,  
  strwrap1,         // string functions 
  htmw;             // rapid html wrapper 

var // initialize a rapid DIV box  
  TopPanel: THtmCustomBox = (
    position: cpAbsolute;
    left: 0; top: 2; height: 0; width: 96;
    pad: 6;
    HeightUnit: hmPixel; WidthUnit: hmPercent;
    bgcolor: 'gray';
    PageAlign: caCenter;
    border: cbNone;
    zindex: 1;
    text: '';
  );
  
  RightPanel: THtmPercentBox;
  LeftPanel: THtmPercentBox;
  ContentPanel: THtmPercentBox;
  FootPanel: THtmPercentBox;

function: TemplateFileToString(fname: string): string;
begin
  // load a file into a string 
  result:= StrLoadFile(fname);
  // format $macrovar's using pwmain format function 
  result:= WebFormat(result);
end;

procedure Init;
begin
  // setup macrovars for template 
  SetVar('macro1' 'blue sky');
  SetVar('macro2' 'green grass');
end; 

procedure Show;
begin
  HtmBegin('Pascal Internet Program');   // open html tags, set page Title 
  // load a macro var template into string, put in box content 
  TopPanel.text:= TemplateFileToString('content1.tpl');
  BoxOut(TopPanel);  // display div box 
  HtmEnd;  // close html tags 
end;

begin
  Init;
  Show;
end.


(*-----------content1.tpl-------------------------------------------------

This is a page about the $macro1 in the air and also about the $macro2 
on the ground.

-------------------------------------------------------------------------*)