Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-12

fpWeb and templates

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ik

Hello,

I'm trying to Create a template that only the content changes inside, like I do with Sinatra and Rails, using fpWeb.

In Sinatra for example you have a file called layout.erb that contains the layout, and inside there is a yield for the content. How can I do the same using fpWeb ?

Thanks,

Ido

LINESIP - Opening the source for communication
http://www.linesip.com
http://www.linesip.co.il
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20101217/ae17df75/attachment.html>

Reply by email

Michael Van Canneyt
to ik
ik wrote 8 lines
Hello, I'm trying to Create a template that only the content changes inside, like I do with Sinatra and Rails, using fpWeb. In Sinatra for example you have a file called layout.erb that contains the layout, and inside there is a yield for the content. How can I do the same using fpWeb ?

In much the same way, I expect ?
In an action, configure the template property:
- Set filename
- In the OnReplaceTag event, set the content.

Michael.

Reply by email

ik
to Michael Van Canneyt

Can I load sub template inside the main template ?

Ido

LINESIP - Opening the source for communication
http://www.linesip.com
http://www.linesip.co.il

Michael Van Canneyt wrote 29 lines
On Fri, 17 Dec 2010, ik wrote: Hello, > > I'm trying to Create a template that only the content changes inside, like > I do with Sinatra > and Rails, using fpWeb. > > In Sinatra for example you have a file called layout.erb that contains the > layout, and inside > there is a yield for the content. > How can I do the same using fpWeb ? > In much the same way, I expect ? In an action, configure the template property: - Set filename - In the OnReplaceTag event, set the content. Michael. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20101217/b50fde8e/attachment.html>

Reply by email

Michael Van Canneyt
to ik
ik wrote
Can I load sub template inside the main template ?

If you set the template to text with more templates in it, it will process the additional templates.

see fcl-base/texts/fptemplate.txt

Note that I just discovered in trunk that some events/properties are not published. I fixed this. But it can be that you'll have to set some properties/events in code in your FPC/Lazarus version, because they're only Public.

Michael.

Reply by email

ABorka
to ik: Can I load sub template inside the main template ? Ido LINESIP - Opening the source for…
ik wrote 36 lines
Can I load sub template inside the main template ? Ido LINESIP - Opening the source for communication http://www.linesip.com http://www.linesip.co.il On Fri, Dec 17, 2010 at 15:30, Michael Van Canneyt < <mailto:>> wrote: On Fri, 17 Dec 2010, ik wrote: Hello, I'm trying to Create a template that only the content changes inside, like I do with Sinatra and Rails, using fpWeb. In Sinatra for example you have a file called layout.erb that contains the layout, and inside there is a yield for the content. How can I do the same using fpWeb ? In much the same way, I expect ? In an action, configure the template property: - Set filename - In the OnReplaceTag event, set the content. Michael.

There are examples for using templates in
...lazarus/components/fpweb/demo/fptemplate/...

also, there is a discussion that contains info about how to do nested templates at
http://www.lazarus.freepascal.org/index.php/topic,10814.0.html

AB

Reply by email