Index: doc/howto.txt ================================================================== --- doc/howto.txt +++ doc/howto.txt @@ -18,10 +18,17 @@ (s:get-page-params) => '("p1" "p2") (s:get-param 'param1) => "value1" (s:get-param 'param1 'number) => number or #f +NOTE: it is often practical to use the generic (s:get-inp ...) which + will first look for the POST input variable and then fall back + to the GET param. This allows one to switch back and forth + between GET and POST during development without changing the code. + +(s:get-inp 'param1) ;; trys to find input by name of param1, followed by trying get-param + Create a link. ~~~~~~~~~~~~~~ (s:a name 'href (s:link-to "pagename/blah" "")) Index: session.scm ================================================================== --- session.scm +++ session.scm @@ -693,11 +693,11 @@ (if (< (length tail) 1) ;; true if done (string-intersperse newresult "&") (loop (car tail)(cadr tail)(cddr tail) newresult)))))) (define (session:link-to self page params) - (let* ((server (if (get-environment-variable "HTTP_HOST") + (let* ((server (or (get-environment-variable "HTTPS_HOST") ;; Assuming HTTPS_HOST is only set if available (get-environment-variable "HTTP_HOST") (get-environment-variable "SERVER_NAME"))) (force-script (sdat-get-script self)) (script (or force-script (let ((script-name (string-split (get-environment-variable "SCRIPT_NAME") "/"))) @@ -752,10 +752,12 @@ res)) ;; should return #f if not a string and can't escape it? (else (if (string? res) (s:html-filter->string res '()) res))))) +;; params are stored as list of key=val +;; (define (session:get-param self key type-params) ;; (session:log s:session "params=" (slot-ref s:session 'params)) (let* ((params (sdat-get-params self)) (res (session:get-param-from params key))) (session:apply-type-preference res type-params))) Index: setup.scm ================================================================== --- setup.scm +++ setup.scm @@ -107,10 +107,16 @@ (session:get-input s:session key params)) (define (s:get-input-keys) (session:get-input-keys s:session)) +;; get-input else, get-param else #f +;; +(define (s:get-inp key . params) + (or (apply s:get-input key params) + (apply s:get-param key params))) + (define (s:load-model model) (session:load-model s:session model)) (define (s:model-path model) (session:model-path s:session model))