[fpc-pascal] fptemplate example wrong?
luca at ventoso.org
Sat Apr 18 12:42:58 CEST 2015
El 18/04/15 a les 07:54, leledumbo ha escrit:
>> but it didn't work in my program.
> The example works just fine with embedded server, only need to adjust path
> to the template. So you might want to send a minimal example that shows it
> doesn't work as you describe.
>> It turns out that the correct OnReplaceTag event to assign is the one of
>> the module itself and not of ModuleTemplate, i.e.:
> There's on OnReplaceTag in TFPWebModule...
> It's very likely that you misunderstood fpWeb application flow.
You are right, the example works, and I'm surprised: I couldn't manage
to make it work in my application (and now I don't know why).
Since I'm not using actions, I thought that might be the problem and
modified my module to use actions just like the example. That didn't
work either (again, now I don't understand why), so I tried with
AllowTagParams:=false and ModuleTemplate.OnGetParam instead.
Since that didn't work either, I traced it and it turns out that what I
said in my original email applies only to OnGetParam:
ModuleTemplate.OnGetParam is never called, instead you have to use
OnGetParam of the module itself.
Probably I made some stupid error in my firsts attempts, and the
inconsistency between OnGetParam/OnReplaceTag didn't help.
More information about the fpc-pascal