On 2/16/06, <b class="gmail_sendername">Jens Axel Søgaard</b> <<a href="mailto:jensaxel@soegaard.net">jensaxel@soegaard.net</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks for the explanation. Your web-cells might do the trick.<br><br>I am trying to make a small library that uses site-wide defaults.<br>E.g in "view.scm" I'd like to write<br><br> (require "html.scm")
<br><br> ;;;<br> ;;; SITE WIDE DEFAULTS<br> ;;;<br><br> (current-page-title "Foo 2.0")<br> (current-page-header '(h1 ((class "page_header")) "Foo 2.0!"))<br> (current-page-style-sheet "
<a href="http://localhost/stylesheet.css">http://localhost/stylesheet.css</a>")<br><br> (define (html-a-page)<br> (html-page #:body "Foo bar baz"))<br><br>where html-page is defined "html.scm".
</blockquote><div><br>
For a given site, I typically wrap the 'start' procedure in the site-wide defaults:<br>
<br>
(define (start ir)<br>
(parameterize ([current-page-title "Foo 2.0"])<br>
(html-a-page)))<br>
<br>
Parameters will work in the web-server provided you are only using
'parameterize', but not if you are using the parameter-procedure set
method.<br>
<br>
I think this approach is most what you want, as cells do something different, and your `persistent parameters' seem very kludgy<br>
<br>
Jay<br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">At the same time, I want the ability to override the defaults<br>for a single request in "
control.scm" with, say,<br><br> (parameterize ([current-page-title "Foo 3.0"])<br> (html-a-page))<br><br>Apart from the losing the settings when a new thread is started,<br>it works nicely.<br><br><br>
Here is html.scm:<br><br>(module html mzscheme<br> (provide (all-defined))<br><br> (require (lib "kw.ss"))<br><br> (define current-page-title (make-parameter "A title"))<br> (define current-page-header (make-parameter '(h1 "A Header")))
<br> (define current-page-body (make-parameter "A body"))<br> (define current-page-content-type<br> (make-parameter "text/html;charset=UTF-8"))<br> (define current-page-style-sheet (make-parameter ""))
<br><br> ; html-page<br> ; Puts all the pieces together to make a complete html page.<br> ; Defaults are taken from site-wide parameters<br> (define/kw<br> (html-page #:key<br> (title
(current-page-title))<br> (title-atts #f)<br> (header (current-page-header))<br> (head-atts
#f)<br> (body (current-page-body))<br> (body-atts
#f)<br> (style-sheet
(current-page-style-sheet))<br> (content-type (current-page-content-type)))<br> (let ([title-atts (if title-atts (list title-atts) '())]<br>
[head-atts (if head-atts (list
head-atts) '())]<br>
[body-atts (if body-atts (list
body-atts) '())])<br> `(html (head (title ,@title-atts ,title)<br>
; external stylesheet<br>
(link ((rel "stylesheet")<br> (type
"text/css")<br> (href
,style-sheet)))<br>
(meta ((http-equiv "Content-Type")<br> (content
,content-type)))<br>
,@head-atts)<br> (body ,@body-atts<br> ,header<br> ,body))))<br></blockquote></div><br clear="all"><br>-- <br>Jay McCarthy <<a href="mailto:jay@cs.brown.edu">jay@cs.brown.edu
</a>><br><a href="http://jay.makeoutcity.com/">http://jay.makeoutcity.com/</a>