views:

124

answers:

2

Hi all,

to export some data i want to be able to generate an html output.

I have some constant content to output, like html headers and footers.

My question is how to deal with that ? Do I have to embed some template (in a resource file) and parse it to make it dynamic ? Do I store my static content in some constant (is there a 255 char limit?) and append them while generating the dynamic content ?

Do you have some hints, useful links, or best practices to share?

Thanks

+8  A: 

Use the Delphi TPageProducer. It generates HTML from a 'close to HTML' template which contains special tage. You respond to these tag in an event and replace them with your own data. Works a treat.

Brian Frost
Ooo... sounds fun! What unit's that in?
Mason Wheeler
@Mason: `grep -r TPageProducer *` prints *HTTPProd.pas*.
Rob Kennedy
TPageProducer is good for more than HTML generation...I've used it in all sorts of places where I had a template file that I needed expanded.
skamradt
+1  A: 

I've created a Delphi project that handles this issue also. I wanted to create a web-platform that uses Delphi-code in the same source-files as the HTML, much like other web-scripting platforms, but still compiles a library to run. (and auto-compiles on changes)

http://xxm.sf.net/

In its basic form it compiles into library that can be run by a handler for IIS (ISAPI extension), InternetExplorer (IInternetProtocol as its own URL scheme), or a stand-alone HTTP process. (Apache module and FireFix plug-in are on the way).

Stijn Sanders