tcl-websh-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronnie Brunner <ronnie.brun...@netcetera.ch>
Subject Re: About Websh... Sessions and stuff..:)
Date Sun, 03 May 2009 22:08:01 GMT
> First of all I would like to congratulate you guys for your efforts WebSh.. it's a good
alternative.. BUT
> It takes a lot of time to develop something serious.. You get lots of errors and have
to debug it like no other...

I guess that depends on how familiar you with it... We've done dome
pretty serious things and usually we get somewhere within a few
hours. But I'm certainly aware that there is some effort needed to get
into Websh.

> The
> web::dispatch thing is very good when you have 1 file.. But what do I
> do when i've got 3 files and I need to communicate one with another?
> Send data and stuff... Because I made a something with web::include...
> and even altered the web::cmdurlcfg -scriptname ...
> How can you use
> the sessions so you ACTUALLY send it from one page(file) to another.. i
> tried almost everything.. and nothing worked... 

The basic idea is that you have an interpreter class that contains all
common code so that you only put in a specific page what you actually
want to have there. In your setup, I'd expect auth.ws3 (and some stuff
to abstract html in the common code, while index.ws3 probably just
renders the index page. Sonething like:

index.ws3:

  if {[isAuthorized]} {
    page "Your title" {
      navigation "My Entry"
      title {Here it comes}
      p {Foo bar zoo}
    }
  }

While [isAuthorized] renders a login page if not authorized.

In such a setup you don't really need web::dispatch.

web::dispatch I'd setup to be used in something like admin.ws3, where
you have a couple of commands needing to be handled, so that admin.ws3
acts like an app itself.

> Or can you
> make it so that once you set a session you can get it back in every
> file you access? (Just like php, not only through links)

Sure: as long as the session handling code is in the common code,
e.g. using a cookie context that refers to a session using a cookie,
so you don't have to put anything in the URL (though nothing keeps you
from doing this).

> How
> should I access those multiple files if i need them? How should I
> rescript my script in order to work that way.. (clearly: i go to my
> site, i see index.ws3 that includes auth.ws3  then i chose a link to
> register, .. the form & settings go on.. Registration is succesful,
> i look in my database and it works, then i login succesfully.. and then
> the problems come... sessions work only on the first page after the
> login (map.ws3) but only a part there.. for the rest i get some weird
> problems, sometimes a few procs don't work..)

This should be answered by the above explanation. Maybe the additional
hint helps:

in websh.conf, use

  proc web::interpmap {file} {
    return /path-to-your/wrapper
  }
  web::interpclasscfg /path-to-your/wrapper maxrequests 0

your wrapper looks like:

  # only source the code on the first request
  web::initializer {
    web::include /path-to-your/common-code
  }
  # process the actual web page
  web::include "[web::config script]"

and your common-code contains all your shared code used in the various
pages like index.ws3, register.ws3 etc.

hth

Ronnie
-- 
Ronnie Brunner | ronnie.brunner@netcetera.ch
phone +41-44-247 79 79 | fax +41-44-247 70 75
Netcetera AG | 8040 Zürich | Switzerland | http://netcetera.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org


Mime
View raw message