Hi Immanual,
On 12/15/05, Immanuel Normann <i.normann@iu-bremen.de> wrote:
> My general objection is that there is no comprehensible separation
> between logic and layout in the surflets. I mean something like the so
> called "Modell View Control' design pattern. May be it is just a matter
> of insufficient documentation in this respect.
I don't quite understand what you mean with "logic" and "layout": The
program flow is very much seperated from the "layout" or "content",
that was the basic idea to develop SUrflets. E.g. the names of the
input fields ("layout") don't appear in the code ("logic"). And with
scheme you can write your simple routines that enter some text or even
input-fields in some point of the SXML-tree representing your web
page.
However, there no such thing as a "Content Manager" where you have
your layout structure and just provide the content. Nevertheless, the
surflets let you create your own content manager. And I don't know of
any other server side scripting system where this could be easier (but
maybe I don't know enough server side scripting systems...)
> To give an example:
> Just by accident (i.e. by scanning some example code) I figured out how
> to set the width of a text input field with the function
> make-text-field.
This is described in the manual at
http://www.scsh.net/resources/sunet-manual/man-Z-H-8.html#node_sec_Temp_16
However, I admit that you have to know some HTML to provide the right
attributes to make-text-field, or, in general, use the SUrflet
functions. [Maybe you already know my favorite source for HTML
knowledge (assuming you know German): http://de.selfhtml.org/]
> But for instance I have no clue how to manipulate
> layout in the "surflet-form" function. I am not asking for special case
> problems, I am rather interested in the general concept concerning
> layout encoding inside the surflet functions.
What do you mean with "layout in the surflet-form function"? Within
surflet-form your are free with your layout, aren't you? Or do you
mean the attributes you want to provide the input-form? At
http://www.scsh.net/resources/sunet-manual/man-Z-H-8.html#node_idx_324
you see that surflet-form accepts HTML-attributes as a parameter,
which are inserted into the HTML <FORM...> entity.
> Moreover I have problems with "get-bindings": Appearently I can't use it
> to retrieve some hardcoded key-value pairs. get-bindings seems to
> support only generated key-value pairs (e.g. generated by make-text-field).
I don't understand what you mean with hardcoded vs. generated
key-value pairs. Get-bindings does not know where the key-value pairs
come from. It extracts both of them. Here's an example SUrflet that
does it:
(define-structure surflet surflet-interface
(open scheme-with-scsh
surflets)
(begin
(define (main req)
(let ((bindings (get-bindings req)))
(display bindings) (newline) ; displays on terminal
(send-html/finish ; displays in browser
`(html (body (p "Bindings were "
,(format #f "~a" bindings)))))))
))
If you call the webpage with
http://localhost:8080/surflet/bindings.scm?a=2123
you'll get
Bindings where ((a . 2123))
as answer.
> Right now I see only these two alternatives:
> 1) Use surflet build in functions like surflet-form => unclear how to
> influence the layout
(surflet-form k-url GET '(@ (accept-charset "ISO-8859-1 ISO-8859-2"))
<any SXML>*)
> 2) Hardcode html => how do I get bindings?
with get-bindings and extract-bindings.
See example surflet above.
> I certainly would appriciate more documentation in this respect.
Did you already know the documentation and Howtos at
http://www.scsh.net/resources/sunet-manual/man-Z-H-8.html#node_chap_6 ?
Hope that helps. If not, please let me know.
Yours,
Andreas.
|