[fpc-devel] fpWeb recursive tag replace

2010-06-07 Thread Leonardo M . Ramé
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




  ___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] fpWeb recursive tag replace

2010-06-07 Thread ABorka

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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] fpWeb recursive tag replace

2010-06-07 Thread Leonardo M . Ramé
Thanks I have forgotten the listings example.

Leonardo M. Ramé

http://leonardorame.blogspot.com

--- On Mon, 6/7/10, ABorka fpc-de...@aborka.com wrote:

From: ABorka fpc-de...@aborka.com
Subject: Re: [fpc-devel] fpWeb recursive tag replace
To: FPC developers' list fpc-devel@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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel



  ___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel