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>
<title>My page</title>
</head>

<body>
You are logged in as $user<br>
<a href="blahblah">go 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.

Reply via email to