About Websh... Sessions and stuff..:)

View: New views
3 Messages — Rating Filter:   Alert me  

About Websh... Sessions and stuff..:)

by Andrei George :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 spent a few hours compiling the mod_websh with xampp to find out later on that Apache provides a easy binary of Apache...

The past 3 days  I spent more than 20 hours in total to make a pathetic Register, Login, Request Password and template file..... It wouldn't have taken more than a few hours to make it in PHP! (well.. debugging + sql testing..)
And I still have problems with it .. I'm thinking of deleting it and every file i used for WebSh on my computer because of the time I lost trying to figure out a few simple things ...
I read all the documentation, went through all the examples And i have a few questions(well,a lot more but i'll put some examples later`}

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...

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)

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..)

Thanks in advance...

P.S. Any motives in WHY i should still use WebSh? Cause i already spent a lot of time in learning it...

If you have some extra examples you guys could show me.. i would be very happy to learn out of them..


Andrei


Re: About Websh... Sessions and stuff..:)

by Ronnie Brunner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 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@...
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@...
For additional commands, e-mail: websh-user-help@...


Parent Message unknown Re: About Websh... Sessions and stuff..:)

by Ronnie Brunner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

> Well, I tried out the stuff you said but the somehow the include
> from the interpreter files doesn't work! Because I tried everything
> and i still can't include my functions with it...:(

Are you sure your websh.conf is setup and configured in Apache
correctly? (And that you are not running CGI, but mod_websh)

Important steps to check:
- Is websh.conf actually read by Apache?
- Is the web::interpmap in websh.conf properly sourced?
- Is the referenced interpclass (the file name returned by
  web::interpmap) sourced correctly?
- Does the interpclass handle the actual script correctly?

If you could send a relevant code snipplet, I could try to find what's
wrong.

hth
Ronnie
--
Ronnie Brunner | ronnie.brunner@...
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@...
For additional commands, e-mail: websh-user-help@...