473,729 Members | 2,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Including an include directive at run-time

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
2 1648
http://www.aspfaq.com/2042

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


"chopper" <ch*****@despam med.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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
11685
by: bartek | last post by:
Hi, I'm aware that both quoted and angle-bracketed strings in an #include directive result in implementation-defined file lookup, differing in the fact that #include "foo.h" first checks *something* and then falls back to the same behaviour as #include <foo.h>. Now, in reality #include <foo.h> generally results in file name being checked up in explicitly specified locations (-I command line options, system header locations), while the...
4
15052
by: Exits Funnel | last post by:
Hello, I'm slightly confused about when to use parens around #included files and when to use angle brackets. I understand (I think) that the difference is that the compiler will search in its standard include directories for files included as <file> but not for those included as "file". It's clear to me then that headers for the standard libraries (eg, iostream) should be included using the '#include <iostream>' form while header...
9
6142
by: Trenqo 0 | last post by:
I'm looking for a way to include javascript files from within a ".js" file. This would allow me to only need to link to one ".js" file, and yet still organize my functions into non gargantuan files for easy editing. I'm hoping there is some sort of include or import directive that I could use. Or if no such directive exists, I'm wondering if anyone has written one which I could use. I need to do this without any server side scripting....
6
2238
by: jalkadir | last post by:
Check this out... file foo.hpp includes bar.hpp, but bar.hpp includes foo.hpp. The compiler/linker is having a lot of problem resolving this problem. Does anyone know if there is a way to solve this problem. TIA
1
1337
by: Charles Mills | last post by:
What does the C standard (C99) say about which version of header2.h should be included in the following case - where directory1 is the current directory and directory2 is included in the list of directories to be searched for headers? contents of directory1: file1.c: #include "file1.h" int main(void) { return 0; }
2
3117
by: Kraai | last post by:
in normal asp , and even php i could use the <!--#include file="login.aspx" --> or <!--#include virtual="login.aspx" --> to include pages in my main page without using frames! when i try this with my aspx page's i get the following error! There can be only one 'page' directive
5
1785
by: farmer | last post by:
I need "include" multiple classes from multiple files such as: <%@ Page Language="C#" Debug="true" ValidateRequest="false" Src="~/Auth/Pub/Auth.cs"%> <%@ Page Language="C#" Debug="true" ValidateRequest="false" Src="~/Edit/Item.cs"%> But the compile says can't use more than one "@Page" directive. Or,I need to "include" another class from a .cs into a currently .ascx using:
3
2635
by: Will Chamberlain | last post by:
For the next couple of months I am hosting 2 domains with one host (Brinkster). What I have done is setup a page called default.aspx and a select case for SiteNameURL = Request.ServerVariables("SERVER_NAME"). The only way I can get this to work is to use Response.Redirect for one of the domains. I can include a file (Index.aspx) just fine for domain B. When I attempt to include a file for Domain B I get errors such as: The Connection...
13
15625
by: Rick Anderson | last post by:
Group, I want to define a #include directive from another macro, if possible... For example, the following doesn't work but is basically what I need to do: #define INCLUDE_THIS(header_name) #include header_name
6
6974
by: Bing | last post by:
Hi folks, Is there a way to define a macro that may contain #include directive in its body. If I just put the "#include", it gives error C2162: "expected macro formal parameter" since here I am not using # to concatenate strings. If I use "\# include", then I receive the following two errors: error C2017: illegal escape sequence error C2121: '#' : invalid character : possibly the result of a macro
0
8921
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9148
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4528
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.