[fpc-pascal] fptemplate example wrong?

Luca Olivetti luca at ventoso.org
Sat Apr 18 00:55:28 CEST 2015


I was following the simpletemplate example for fptemplate, where, in
webmodule.pas, it says:

  //ModuleTemplate is a web module global property
  //To use the Template propery of the current web action (which is
visible in
  //the object inspector for every Action), use
  //(Sender as TFPWebAction).Template.FileName := 'mytemplate1.html';
and so on.
  ModuleTemplate.FileName := 'mytemplate1.html';//best to use full path here
  ModuleTemplate.AllowTagParams := true;
  ModuleTemplate.OnReplaceTag := @func1callReplaceTag;

but it didn't work in my program.
It turns out that the correct OnReplaceTag event to assign is the one of
the module itself and not of ModuleTemplate, i.e.:

instead of

ModuleTemplate.OnReplaceTag := ...

it should be

OnReplaceTag :=

I'm using it in a standalone server app, and I used the OnGetParam event
(AllowTagParams is false, I previously tried OnReplaceTag just like the
example), while the example is for a cgi/fastcgi app, but I don't think
that makes a difference.


More information about the fpc-pascal mailing list