[fpc-devel] fpWeb recursive tag replace

ABorka fpc-devel at aborka.com
Tue Jun 8 02:02:02 CEST 2010


On 6/7/2010 16:40, Leonardo M. Ramé wrote:
> Hi, when I use html templates with tags that contains inner tags, the
> ReplaceTag event is fired only once, for the 1st order tag, but not for
> the inner tags.
>
> Example, a home page containing a header (a tag) and a body which
> contains another tag like, for example {+search_form+}. The search_form
> tag, also contains some {+tags+} to be replaced by the main program.
>
> Is there an "official" way to handle this use case?
>
> Leonardo M. Ramé
> http://leonardorame.blogspot.com

An example template attached would have helped, but guessing your problem...

If you use the "AllowTagParams := true;" for a template, then you cannot 
have recursive embedded tags. That is what the tag parameters can be 
used for instead.
For example:
{+search_form
[-formheader=<form blah blah>-]

[-formbody=<input type...>-]

[-formfooter=</form>-]
+}

Your program needs to replace the "search_form" tag by also processing 
the tag parameters.
To see some examples for template usage, try the demo programs under
...\lazarus\components\fpweb\demo\fptemplate\...

AB




More information about the fpc-devel mailing list