Re: [AOLSERVER] ns_returnredirect

2008-04-22 Thread Bas Scheffers

Xavier,

Inside an ADP, you could simply use ns_adp_include. If you want to do  
it in a Tcl file/proc, you coud do:


ns_return 200 text/html [ns_adp_parse -file [file join [ns_info  
pageroot] path/to/my_file.adp]]


Hope that helps,
Bas.

On 22/04/2008, at 6:26 PM, Xavier Bourguignon wrote:


Hello all,

Is there a similar procedure to ns_returnredirect which returns an adp
file with an HTTP code of 200? For example: ns_return index.adp.

I have looked in the API, but I haven't found anything.

Would it be difficult to build such a procedure?

I already know about ns_return 200 text/html html I want to
return, but I would love to be able to pass a file name and not have
to pass the HTML in a string.

I use singlescript = 1 in my configuration file, just in case this
makes a difference in your potential answer.

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.


Re: [AOLSERVER] ns_returnredirect

2008-04-22 Thread Dossy Shiobara
On 2008.04.22, Xavier Bourguignon [EMAIL PROTECTED] wrote:
 Is there a similar procedure to ns_returnredirect which returns an adp
 file with an HTTP code of 200? For example: ns_return index.adp.

Do you want to return just the contents of the ADP, or include it into
your current ADP?  You may want to look at ns_adp_include.


-- 
Dossy Shiobara  | [EMAIL PROTECTED] | http://dossy.org/
Panoptic Computer Network   | http://panoptic.com/
  He realized the fastest way to change is to laugh at your own
folly -- then you can let go and quickly move on. (p. 70)


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


Re: [AOLSERVER] ns_returnredirect

2008-04-22 Thread Robert Seeger
You can also write up a quite ns_adp_forward which does more or less 
what you're looking for so it's easier/cleaner to use. That's what I did 
in several cases.


Rob Seeger

Bas Scheffers wrote:

Xavier,

Inside an ADP, you could simply use ns_adp_include. If you want to do 
it in a Tcl file/proc, you coud do:


ns_return 200 text/html [ns_adp_parse -file [file join [ns_info 
pageroot] path/to/my_file.adp]]


Hope that helps,
Bas.

On 22/04/2008, at 6:26 PM, Xavier Bourguignon wrote:


Hello all,

Is there a similar procedure to ns_returnredirect which returns an adp
file with an HTTP code of 200? For example: ns_return index.adp.

I have looked in the API, but I haven't found anything.

Would it be difficult to build such a procedure?

I already know about ns_return 200 text/html html I want to
return, but I would love to be able to pass a file name and not have
to pass the HTML in a string.

I use singlescript = 1 in my configuration file, just in case this
makes a difference in your potential answer.

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.





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


Re: [AOLSERVER] ns_returnredirect

2008-04-22 Thread Xavier Bourguignon
Thanks Bas, I'll try that later when I go back home.

On 22/04/2008, Bas Scheffers [EMAIL PROTECTED] wrote:
 Xavier,

  Inside an ADP, you could simply use ns_adp_include. If you want to do it in
 a Tcl file/proc, you coud do:

  ns_return 200 text/html [ns_adp_parse -file [file join [ns_info pageroot]
 path/to/my_file.adp]]

  Hope that helps,
  Bas.


  On 22/04/2008, at 6:26 PM, Xavier Bourguignon wrote:


 
  Hello all,
 
  Is there a similar procedure to ns_returnredirect which returns an adp
  file with an HTTP code of 200? For example: ns_return index.adp.
 
  I have looked in the API, but I haven't found anything.
 
  Would it be difficult to build such a procedure?
 
  I already know about ns_return 200 text/html html I want to
  return, but I would love to be able to pass a file name and not have
  to pass the HTML in a string.
 
  I use singlescript = 1 in my configuration file, just in case this
  makes a difference in your potential answer.
 
  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


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


Re: [AOLSERVER] ns_returnredirect

2008-04-22 Thread Tom Jackson
Xavier,

But just note: ns_returnrediect is not used to return content, it is used to 
notify the client that your content has moved to another URL:

ns_returnredirect /

This would return to the home page of the current server.

Here is a manpage on ns_return***:

http://rmadilo.com/files/nsapi/ns_return.html

On Tuesday 22 April 2008 05:24, Xavier Bourguignon wrote:
 Thanks Bas, I'll try that later when I go back home.

 On 22/04/2008, Bas Scheffers [EMAIL PROTECTED] wrote:
  Xavier,
 
   Inside an ADP, you could simply use ns_adp_include. If you want to do it
  in a Tcl file/proc, you coud do:
 
   ns_return 200 text/html [ns_adp_parse -file [file join [ns_info
  pageroot] path/to/my_file.adp]]
 
   Hope that helps,
   Bas.
 
   On 22/04/2008, at 6:26 PM, Xavier Bourguignon wrote:
   Hello all,
  
   Is there a similar procedure to ns_returnredirect which returns an adp
   file with an HTTP code of 200? For example: ns_return index.adp.
  
   I have looked in the API, but I haven't found anything.
  
   Would it be difficult to build such a procedure?
  
   I already know about ns_return 200 text/html html I want to
   return, but I would love to be able to pass a file name and not have
   to pass the HTML in a string.
  
   I use singlescript = 1 in my configuration file, just in case this
   makes a difference in your potential answer.
  
   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.


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


Re: [AOLSERVER] ns_returnredirect

2008-04-22 Thread Xavier Bourguignon
Dossy, I just want to return it from a tcl procedure. Basically, after
having done what needs to be done on the tcl side of things (DB
queries, processing of information, etc...), I want to display my adp
page, but I want to keep tcl seperate to html, I don't really want to
write procedures that output html like this example below:

proc display_index_logged_in {} {
set user [get_logged_in_user]
ns_adp_puts [subst {html
head
titleMy page/title
/head

body
You are logged in as $userbr
a href=blahblahgo here/a
a href=foofoo go there/a
/body}]
}

I want to keep things separate from one another. (psycological I guess).

I understand that it may not always be possible to do so, but if I can
do that as much as possible, I'll be happy.

Robert, I would not know where to start to write a procedure like
ns_adp_forward. I will test Bas's code this evening: ns_return 200
text/html [ns_adp_parse -file [file join [ns_info pageroot]
path/to/my_file.adp]]. I think this will be exactly what I need.

Tom, thanks for the tip. I have used ns_returnredirect so far and
everything has worked fine, but really what I am trying to do is not a
redirect, it is just displaying a file within the same
domain/server/site. So I want to get away from ns_returnredirect
anyway, unless I need a redirect of course.

Thank you all.

On 22/04/2008, Tom Jackson [EMAIL PROTECTED] wrote:
 Xavier,

  But just note: ns_returnrediect is not used to return content, it is used to
  notify the client that your content has moved to another URL:

  ns_returnredirect /

  This would return to the home page of the current server.

  Here is a manpage on ns_return***:

  http://rmadilo.com/files/nsapi/ns_return.html


  On Tuesday 22 April 2008 05:24, Xavier Bourguignon wrote:
   Thanks Bas, I'll try that later when I go back home.
  
   On 22/04/2008, Bas Scheffers [EMAIL PROTECTED] wrote:
Xavier,
   
 Inside an ADP, you could simply use ns_adp_include. If you want to do it
in a Tcl file/proc, you coud do:
   
 ns_return 200 text/html [ns_adp_parse -file [file join [ns_info
pageroot] path/to/my_file.adp]]
   
 Hope that helps,
 Bas.
   
 On 22/04/2008, at 6:26 PM, Xavier Bourguignon wrote:
 Hello all,

 Is there a similar procedure to ns_returnredirect which returns an adp
 file with an HTTP code of 200? For example: ns_return index.adp.

 I have looked in the API, but I haven't found anything.

 Would it be difficult to build such a procedure?

 I already know about ns_return 200 text/html html I want to
 return, but I would love to be able to pass a file name and not have
 to pass the HTML in a string.

 I use singlescript = 1 in my configuration file, just in case this
 makes a difference in your potential answer.

 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.


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


Re: [AOLSERVER] ns_returnredirect

2008-04-22 Thread Tom Jackson
Xavier,

Yeah, it looks like you want something like ns_adp_parse -file ... 

This is kind of like calling a procedure, so you have to pass in arguments and 
then bind them in the adp page you call.

As an alternative to using a tcl page and then calling another adp, what you 
could do is turn your tcl page into a procedure and call the proc from within 
the adp page. Also, everything within a % % is a tcl script. You could keep 
it at the top of an adp. 

Also, I think code in adps is cached, or could be cached, which might be an 
advantage over a tcl page.

(But for testing, I would probably lean for putting all you tcl page code at 
the top of an adp inside a % %, and move it somewhere else if/when it 
works.)

tom jackson

On Tuesday 22 April 2008 09:28, Xavier Bourguignon wrote:
 Dossy, I just want to return it from a tcl procedure. Basically, after
 having done what needs to be done on the tcl side of things (DB
 queries, processing of information, etc...), I want to display my adp
 page, but I want to keep tcl seperate to html, I don't really want to
 write procedures that output html like this example below:

 proc display_index_logged_in {} {
 set user [get_logged_in_user]
 ns_adp_puts [subst {html
 head
 titleMy page/title
 /head

 body
 You are logged in as $userbr
 a href=blahblahgo here/a
 a href=foofoo go there/a
 /body}]
 }

 I want to keep things separate from one another. (psycological I guess).

 I understand that it may not always be possible to do so, but if I can
 do that as much as possible, I'll be happy.

 Robert, I would not know where to start to write a procedure like
 ns_adp_forward. I will test Bas's code this evening: ns_return 200
 text/html [ns_adp_parse -file [file join [ns_info pageroot]
 path/to/my_file.adp]]. I think this will be exactly what I need.

 Tom, thanks for the tip. I have used ns_returnredirect so far and
 everything has worked fine, but really what I am trying to do is not a
 redirect, it is just displaying a file within the same
 domain/server/site. So I want to get away from ns_returnredirect
 anyway, unless I need a redirect of course.

 Thank you all.

 On 22/04/2008, Tom Jackson [EMAIL PROTECTED] wrote:
  Xavier,
 
   But just note: ns_returnrediect is not used to return content, it is
  used to notify the client that your content has moved to another URL:
 
   ns_returnredirect /
 
   This would return to the home page of the current server.
 
   Here is a manpage on ns_return***:
 
   http://rmadilo.com/files/nsapi/ns_return.html
 
   On Tuesday 22 April 2008 05:24, Xavier Bourguignon wrote:
Thanks Bas, I'll try that later when I go back home.
   
On 22/04/2008, Bas Scheffers [EMAIL PROTECTED] wrote:
 Xavier,

  Inside an ADP, you could simply use ns_adp_include. If you want to
 do it in a Tcl file/proc, you coud do:

  ns_return 200 text/html [ns_adp_parse -file [file join [ns_info
 pageroot] path/to/my_file.adp]]

  Hope that helps,
  Bas.

  On 22/04/2008, at 6:26 PM, Xavier Bourguignon wrote:
  Hello all,
 
  Is there a similar procedure to ns_returnredirect which returns an
  adp file with an HTTP code of 200? For example: ns_return
  index.adp.
 
  I have looked in the API, but I haven't found anything.
 
  Would it be difficult to build such a procedure?
 
  I already know about ns_return 200 text/html html I want to
  return, but I would love to be able to pass a file name and not
  have to pass the HTML in a string.
 
  I use singlescript = 1 in my configuration file, just in case this
  makes a difference in your potential answer.
 
  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.
 
   --
   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.