I am sorry, wouldn't know about this, I am very new to aolserver. I
set my singlescript param to 1 because I prefer it that way, may be
there is something there indeed.
On 16/03/2008, Bas Scheffers <[EMAIL PROTECTED]> wrote:
> Well, this should work. Normally, anything between <% %> is executed
> in the global scope and as $REQ is in the global scope it should be
> accessible.
>
> I noticed you are using the new parser that allows you to do "... { %>
> some html <% } ...", something I have never done. Could it be this
> works differently and every block is executed in a different scope?
> (i.e.: parsed into a proc and then executed)
>
>
> Bas.
>
>
> On 16/03/2008, at 8:32 PM, Xavier Bourguignon wrote:
>
> > Bas, i forgot to attach my code, here is the procedure, it is called
> > at the beginning of every request.
> >
> > proc ::gs_admin::req_init {conn arg why} {
> > variable INIT
> > global REQ
> >
> > catch {unset REQ}
> >
> > if {!$INIT} {
> > ns_log Waning "==>::gs_admin::req_init - gs_admin must be
> > initialised before use..."
> > return
> > }
> >
> > ns_log Notice "==>Starting request"
> >
> > # check the user is logged in
> > set logged_in [::gs_login::logged_in $conn]
> >
> > if {[lindex $logged_in 0]} {
> > set REQ(LOGIN_OK) 1
> > } else {
> > set REQ(LOGIN_OK) 0
> > set REQ(LOGIN_REASON) [lindex $logged_in 1]
> > }
> >
> > # everything is fine, lets carry on
> > return "filter_ok"
> > }
> >
> > what happend now is that in my adp file I call: <% if
> > {$REQ(LOGIN_OK)} { %>
> > and I get this error:
> > can't read "REQ(LOGIN_OK)": no such variable
> > while executing
> > "if {$REQ(LOGIN_OK)} {
> >
> > Very weird indeed.
> >
> > Is there a way to find out which scope the code is in at any one point
> > in the execution?
> >
> > Thank you
> >
> > On 16/03/2008, Xavier Bourguignon <[EMAIL PROTECTED]> wrote:
> >> Thanks for the answer Bas.
> >>
> >> I have done this now: set ::variablename value
> >>
> >> in adp: if {$::variablename} {
> >> blah
> >> }
> >>
> >> so it works now, but I have no idea as to why I should explicitly add
> >> the :: for this to work. The tcl code runs in a function which has
> >> been registered like this: ns_register_filter postauth.
> >>
> >> Thank you
> >>
> >>
> >> On 16/03/2008, Bas Scheffers <[EMAIL PROTECTED]> wrote:
> >>> The correct way to just access a variable is:
> >>>
> >>> <%= $variable %>
> >>>
> >>> No need for "puts". This works also:
> >>>
> >>> <%= [clock seconds] %>
> >>>
> >>> Which puts the output of that command in the HTML.
> >>>
> >>> But it sounds like you have a scope problem. Any way you can post
> >>> your
> >>> actual code?
> >>>
> >>> If you set the variable inside a procedure, you could use "upvar" to
> >>> make it available in the scope where you want to display it. If you
> >>> put a variable in the global scope, you can access it like so:
> >>>
> >>> <%= $::variable %>
> >>>
> >>> Bas.
> >>>
> >>>
> >>> On 16/03/2008, at 8:40 AM, Xavier Bourguignon wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> I have a variable set in my tcl code. e.g: set uname "myuname"
> >>>>
> >>>> how do I use this in my adp page?. e.g: Your username is: <%puts
> >>>> $uname%>
> >>>>
> >>>> It does not seem to work, everytime i get a tcl error saying that
> >>>> uname does not exists. I tried to make uname global, to no avail.
> >>>>
> >>>> Thank you
> >>>>
> >>>> --
> >>>> Xavier Bourguignon
> >>>>
> >>>>
> >>>
> >>>> --
> >>>> AOLserver - http://www.aolserver.com/
> >>>>
> >>>> To Remove yourself from this list, simply send an email to <[EMAIL
> PROTECTED]
> >>>>> with the
> >>>> body of "SIGNOFF AOLSERVER" in the email message. You can leave the
> >>>> Subject: field of your email blank.
> >>>
> >>>
> >>>
> >>> --
> >>> AOLserver - http://www.aolserver.com/
> >>>
> >>> To Remove yourself from this list, simply send an email to <[EMAIL
> PROTECTED]
> >>> > with the
> >>> body of "SIGNOFF AOLSERVER" in the email message. You can leave
> >>> the Subject: field of your email blank.
> >>>
> >>
> >>
> >>
> >> --
> >>
> >> Xavier Bourguignon
> >>
> >
> >
> > --
> > Xavier Bourguignon
> >
> >
> > --
> > AOLserver - http://www.aolserver.com/
> >
> > To Remove yourself from this list, simply send an email to <[EMAIL
> PROTECTED]
> > > with the
> > body of "SIGNOFF AOLSERVER" in the email message. You can leave the
> > Subject: field of your email blank.
>
>
> --
> AOLserver - http://www.aolserver.com/
>
> To Remove yourself from this list, simply send an email to <[EMAIL
> PROTECTED]> with the
> body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
> field of your email blank.
>
--
Xavier Bourguignon
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]>
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
field of your email blank.