By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,948 Members | 1,595 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,948 IT Pros & Developers. It's quick & easy.

Including an include directive at run-time

P: n/a
Please excuse the long post but I can't think of shorter way of
explaining the issue.

Please could someone advise on the following:
I'm writing preview functionality for a CMS written in ASP.
Currently, when a page is published (physical file created in the
website) it contains include directives to pull in commonly used bits of
HTML and ASP such as the header and footer of pages.

In the preview functionality I want to be able to have asp deliver the
content directly to the browser rather than have to physically publish
the files first. In other words, rather than merging a template with the
content stored in the database and creating the file, I want to be able
to store all of the page source in a variable and response.write it to
the browser.

The problem I'm having is that when the page is written to the browser
it's putting the actual include directive and not the content of the
included file into the page. I've got round this for the html includes
by reading the actual file content into a variable and merging that with
the content. The issue is with the asp pages that need to be included as
the result is a page that includes the actual asp and not the content
that should be generated by the asp.

For example, when a page is published on the site, the template might
include the following code "<!--#include file="something.asp"-->. So
when the published page is opened in the browser it 'includes' the
rendered result of something.asp at runtime.
When I store the merged template in a variable and output it, the
'rendered' page source includes the actual include directive
"<!--#include file="something.asp"-->"
If I use an FSO to pull something.asp in, I get the server-side asp in
the source of the rendered page and therefore tries to run it as
client-side vbscript which will not work.

I guess what I somehow need to do is pull in the content that is being
generated by the asp page (that was previously 'included') and display
the rendered HTML. Can anyone tell me if this is possible and, if so,
how it's done?
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
http://www.aspfaq.com/2042

--
http://www.aspfaq.com/
(Reverse address to reply.)


"chopper" <ch*****@despammed.com> wrote in message
news:41***********************@news-text.dial.pipex.com...
Please excuse the long post but I can't think of shorter way of
explaining the issue.

Please could someone advise on the following:
I'm writing preview functionality for a CMS written in ASP.
Currently, when a page is published (physical file created in the
website) it contains include directives to pull in commonly used bits of
HTML and ASP such as the header and footer of pages.

In the preview functionality I want to be able to have asp deliver the
content directly to the browser rather than have to physically publish
the files first. In other words, rather than merging a template with the
content stored in the database and creating the file, I want to be able
to store all of the page source in a variable and response.write it to
the browser.

The problem I'm having is that when the page is written to the browser
it's putting the actual include directive and not the content of the
included file into the page. I've got round this for the html includes
by reading the actual file content into a variable and merging that with
the content. The issue is with the asp pages that need to be included as
the result is a page that includes the actual asp and not the content
that should be generated by the asp.

For example, when a page is published on the site, the template might
include the following code "<!--#include file="something.asp"-->. So
when the published page is opened in the browser it 'includes' the
rendered result of something.asp at runtime.
When I store the merged template in a variable and output it, the
'rendered' page source includes the actual include directive
"<!--#include file="something.asp"-->"
If I use an FSO to pull something.asp in, I get the server-side asp in
the source of the rendered page and therefore tries to run it as
client-side vbscript which will not work.

I guess what I somehow need to do is pull in the content that is being
generated by the asp page (that was previously 'included') and display
the rendered HTML. Can anyone tell me if this is possible and, if so,
how it's done?

Jul 19 '05 #2

P: n/a
Aaron [SQL Server MVP] wrote:
http://www.aspfaq.com/2042


Thanks for your reply Aaron.
I tried using server.execute but it's actually executing in the code
whilst I'm building up the the variable that contains the page source I
want to send to the browser. As a result, it's outputting the executed
file first, the outputting the rest of the code I built up in the variable.

The only way it would work in my case is if I could somehow return to a
variable the result of the server.execute (or something similar). Is
this possible?
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.