[fpc-pascal] CGI application

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Thu May 20 15:16:09 CEST 2010


Using powtils you can write something like the example bellow, which I
consider cleaner and easier to maintain:

From: http://code.google.com/p/powtils/source/browse/dev#dev/examples/raw-template

program project1; {$IFDEF FPC}{$mode objfpc}{$H+}{$ENDIF} {$APPTYPE CONSOLE}

uses
  pwinit, pwmain;

var
  MyMacroVar: string;

begin
  MyMacroVar:= '<b>really, really</b> splendid and <i>nice</i> ';
  SetVar('MacroVar', MyMacroVar);
  { TemplateRaw is less secure than TemplateOut and allows special characters }
  TemplateRaw('template.htm');
end.

=========

<html>
<head>
</head>
<body>
 Hello, isn't it $MacroVar today?
</body>
</html>


-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list