[fpc-devel] fpWeb recursive tag replace

Leonardo M. Ramé martinrame at yahoo.com
Tue Jun 8 02:36:09 CEST 2010


Thanks I have forgotten the listings example.

Leonardo M. Ramé

http://leonardorame.blogspot.com

--- On Mon, 6/7/10, ABorka <fpc-devel at aborka.com> wrote:

From: ABorka <fpc-devel at aborka.com>
Subject: Re: [fpc-devel] fpWeb recursive tag replace
To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
Date: Monday, June 7, 2010, 9:02 PM

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

_______________________________________________
fpc-devel maillist  -  fpc-devel at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20100607/697bbd96/attachment.html>


More information about the fpc-devel mailing list