[html-template-devel] Re: Concerning TBNL and HTML-TEMPLATE

Edi Weitz edi at agharta.de
Thu Jun 9 08:44:29 UTC 2005


Hi Dan!

Please use the mailing lists for future questions like these - see Cc
and the links on the websites.  Thanks.

On Wed, 08 Jun 2005 19:47:00 -0400, Dan Larkin <dl9534 at albany.edu> wrote:

>     First of all let me thank you for your terrific software.  The
>     availability of your software (and others too) has really helped
>     my picking up lisp.

You're welcome... :)

>     For the past few days I've been reading c.l.l (but not posting,
>     because I don't know nearly enough to participate in any of the
>     current discussions).  My background with lisp began this winter
>     when I started a course at my University in scheme.  Since then
>     I've been trying to get going with common lisp and web
>     programming (since that is what I do during the summer at my
>     job).

Good luck!  I'm sure you'll have fun with CL.

>     But anyway, on to my question: How can I get a template parsed
>     with html-template to come up with as a tbnl page?  I'm working
>     off the tbnl-test example so I have just created a new function
>     add-artist' and added it to dispatch table, but I can't figure out
>     how to get it to output the results of parsing a template.

Something like

  (defun add-artist ()
    (with-output-to-string (*default-template-output*)
      (fill-and-print-template template/printer values)))

should do it.  Note that FILL-AND-PRINT-TEMPLATE prints its output to
the stream *DEFAULT-TEMPLATE-OUTPUT* and TBNL wants a string returned
by the handler, so the code above makes sure everything printed to
this stream ends up in a string which is returned by the function.

This assumes that ADD-ARTIST is a handler, not a dispatcher.

>     Also another issue I am having is get-parameters, get-parameter,
>     post-parameters and post-parameter all don't seem to work.  Even
>     with something like
> (defun add-artist ()
>   (with-html
>    (:html
>     (get-parameters))))
>     does not work (the way I'd expect it to at least, it produces only
>     the prologue and <html></html> even when passed parameters).

WITH-HTML is the macro which uses CL-WHO from the test suite, right?
If that's the case you must wrap the form (GET-PARAMETERS) with
something that asks CL-WHO to include it in the output, otherwise
it'll only be evaluated for its side effects.  One of

  (str (get-parameters))
  (esc (get-parameters))
  (fmt "~S" (get-parameters))

should do it.

Does that help?

Cheers,
Edi.



More information about the Html-template-devel mailing list