473,324 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Server-Side Includes

RN1
The book I am referring to learn ASP states the following about server-
side includes:

==============================================
The code in a server-side include file is inserted into the pages that
use it BEFORE the page's ASP code is evaluated. This means that you
can put ASP code inside the include file, and it will be executed like
it was part of the page that includes it. On the other hand, it means
that you cannot use ASP to determine which page to include.
==============================================

But as opposed to the last line in the above para, the following code
makes use of ASP to determine which page to include:

<%
Dim intA,intB

intA=5
intB=6

If(intA>intB) Then
%>
<!-- #include file="File1.inc"-->
<%
Else
%>
<!-- #include file="File2.inc"-->
<%
End If
%>

File1.inc has only one line - This is File1.
Similarly, File2.inc also has only one line - This is File2.

Now since the If condition in the above code evaluates to False,
File2.inc gets included & hence the browser displays

This is File2.

But if I change the value of intA to, say, 10, so that the If
condition evaluates to True, then File1.inc gets included &
consequently the browser displays

This is File1.

So isn't the last line in the above para which I cited from the ASP
book wrong?
Dec 16 '07 #1
10 1684
RN1 wrote:
The book I am referring to learn ASP states the following about
server- side includes:

==============================================
The code in a server-side include file is inserted into the pages that
use it BEFORE the page's ASP code is evaluated. This means that you
can put ASP code inside the include file, and it will be executed like
it was part of the page that includes it. On the other hand, it means
that you cannot use ASP to determine which page to include.
==============================================

But as opposed to the last line in the above para, the following code
makes use of ASP to determine which page to include:

<%
Dim intA,intB

intA=5
intB=6

If(intA>intB) Then
%>
<!-- #include file="File1.inc"-->
<%
Else
%>
<!-- #include file="File2.inc"-->
<%
End If
%>

File1.inc has only one line - This is File1.
Similarly, File2.inc also has only one line - This is File2.

Now since the If condition in the above code evaluates to False,
File2.inc gets included & hence the browser displays

This is File2.

But if I change the value of intA to, say, 10, so that the If
condition evaluates to True, then File1.inc gets included &
consequently the browser displays

This is File1.

So isn't the last line in the above para which I cited from the ASP
book wrong?
No. They are both processed.
http://classicasp.aspfaq.com/files/d...ude-files.html

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Dec 16 '07 #2

"RN1" <rn**@rediffmail.comwrote in message
news:6f**********************************@d27g2000 prf.googlegroups.com...
The book I am referring to learn ASP states the following about server-
side includes:

==============================================
The code in a server-side include file is inserted into the pages that
use it BEFORE the page's ASP code is evaluated. This means that you
can put ASP code inside the include file, and it will be executed like
it was part of the page that includes it. On the other hand, it means
that you cannot use ASP to determine which page to include.
==============================================

But as opposed to the last line in the above para, the following code
makes use of ASP to determine which page to include:

<%
Dim intA,intB

intA=5
intB=6

If(intA>intB) Then
%>
<!-- #include file="File1.inc"-->
<%
Else
%>
<!-- #include file="File2.inc"-->
<%
End If
%>

File1.inc has only one line - This is File1.
Similarly, File2.inc also has only one line - This is File2.

Now since the If condition in the above code evaluates to False,
File2.inc gets included & hence the browser displays

This is File2.

But if I change the value of intA to, say, 10, so that the If
condition evaluates to True, then File1.inc gets included &
consequently the browser displays

This is File1.

So isn't the last line in the above para which I cited from the ASP
book wrong?
According the what the book says your page will look like this before it is
parsed and executed as an ASP page:-

<%
Dim intA,intB

intA=5
intB=6

If(intA>intB) Then
%>
This is File1.
<%
Else
%>
This is File2.
<%
End If
%>

As you can see both includes have been added. Try changing the content of
file2 to this:-

<%
End If
%>
This is File2.
<%
If False Then
%>

The resulting file before parsing becomes:-

<%
Dim intA,intB

intA=5
intB=6

If(intA>intB) Then
%>
This is File1.
<%
Else
%>

<%
End If
%>
This is File2.
<%
If False Then
%>
<%
End If
%>

The resulting output is:-

This is File1.
This is File2.

--
Anthony Jones - MVP ASP/ASP.NET
Dec 16 '07 #3
RN1
On Dec 16, 9:22 pm, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:
RN1 wrote:
The book I am referring to learn ASP states the following about
server- side includes:
==============================================
The code in a server-side include file is inserted into the pages that
use it BEFORE the page's ASP code is evaluated. This means that you
can put ASP code inside the include file, and it will be executed like
it was part of the page that includes it. On the other hand, it means
that you cannot use ASP to determine which page to include.
==============================================
But as opposed to the last line in the above para, the following code
makes use of ASP to determine which page to include:
<%
Dim intA,intB
intA=5
intB=6
If(intA>intB) Then
%>
<!-- #include file="File1.inc"-->
<%
Else
%>
<!-- #include file="File2.inc"-->
<%
End If
%>
File1.inc has only one line - This is File1.
Similarly, File2.inc also has only one line - This is File2.
Now since the If condition in the above code evaluates to False,
File2.inc gets included & hence the browser displays
This is File2.
But if I change the value of intA to, say, 10, so that the If
condition evaluates to True, then File1.inc gets included &
consequently the browser displays
This is File1.
So isn't the last line in the above para which I cited from the ASP
book wrong?

No. They are both processed.http://classicasp.aspfaq.com/files/d...do-i-dynamical...

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"- Hide quoted text -

- Show quoted text -
Something's wrong with this newsgroup. The page which lists all the
posts says that there are 3 threads in this post & that Bob & Andrews
have answered my post but I don't find Andrew's response anywhere!!
Dec 17 '07 #4
Something's wrong with this newsgroup. The page which lists all the
posts says that there are 3 threads in this post & that Bob & Andrews
have answered my post but I don't find Andrew's response anywhere!!
Using Thunderbird as my newsreader I see a reply from Bob Barrows and
Anthony Jones, but no Andrews.

Steve
Dec 17 '07 #5
RN1
On Dec 17, 7:24 pm, Dooza <stev...@SPAM.dooza.tvwrote:
Something's wrong with this newsgroup. The page which lists all the
posts says that there are 3 threads in this post & that Bob & Andrews
have answered my post but I don't find Andrew's response anywhere!!

Using Thunderbird as my newsreader I see a reply from Bob Barrows and
Anthony Jones, but no Andrews.

Steve
Ooops sorry.....I meant Anthony....not Andrews :-) I don't use any
newsreader as such....depend on IE6.0.....need to change to Outlook
Express I guess.....

Dec 17 '07 #6
RN1
According the what the book says your page will look like this before it is
parsed and executed as an ASP page:-

<%
Dim intA,intB

intA=5
intB=6

If(intA>intB) Then
%>
This is File1.
<%
Else
%>
This is File2.
<%
End If
%>

As you can see both includes have been added. Try changing the content of
file2 to this:-

<%
End If
%>
This is File2.
<%
If False Then
%>

The resulting file before parsing becomes:-

<%
Dim intA,intB

intA=5
intB=6

If(intA>intB) Then
%>
This is File1.
<%
Else
%>

<%
End If
%>
This is File2.
<%
If False Then
%>
<%
End If
%>

The resulting output is:-

This is File1.
This is File2.

--
Anthony Jones - MVP ASP/ASP.NET
Sorry Anthony but I couldn't exactly understand what are you trying to
say. Could you please be bit more specific on what you are trying to
say?

Thanks
Dec 17 '07 #7
RN1 wrote:
On Dec 17, 7:24 pm, Dooza <stev...@SPAM.dooza.tvwrote:
> Something's wrong with this newsgroup. The page which lists all the
posts says that there are 3 threads in this post & that Bob & Andrews
have answered my post but I don't find Andrew's response anywhere!!

Using Thunderbird as my newsreader I see a reply from Bob Barrows and
Anthony Jones, but no Andrews.

Steve

Ooops sorry.....I meant Anthony....not Andrews :-) I don't use any
newsreader as such....depend on IE6.0.....need to change to Outlook
Express I guess.....
Don't need OE, Thunderbird is better, in my humble opinion. Beats the
life out of web interfaces for newsgroups.

Steve
Dec 17 '07 #8
Sorry Anthony but I couldn't exactly understand what are you trying to
say. Could you please be bit more specific on what you are trying to
say?
Due to the nature of server side includes being processed before the asp
is processed, you can't use this kind of conditional server side includes.

He shows that the page loads both includes first, and then the server
executes the ASP.

Have a look at this: http://www.4guysfromrolla.com/webtech/022504-1.shtml

Steve
Dec 17 '07 #9
RN1
On Dec 17, 9:19 pm, Dooza <stev...@SPAM.dooza.tvwrote:
Sorry Anthony but I couldn't exactly understand what are you trying to
say. Could you please be bit more specific on what you are trying to
say?

Due to the nature of server side includes being processed before the asp
is processed, you can't use this kind of conditional server side includes.

He shows that the page loads both includes first, and then the server
executes the ASP.

Have a look at this:http://www.4guysfromrolla.com/webtech/022504-1.shtml

Steve
OK....fine.....I got it. The bottomline is ALL include files will be
processed (before any ASP code in the ASP page with the includes is
executed) & included in the ASP page irrespective of whether the
include files have been included conditionally or not. Depending on
the If.....Else condition, the appropriate output will be spat out.

Correct?
Dec 17 '07 #10
RN1 wrote:
On Dec 17, 9:19 pm, Dooza <stev...@SPAM.dooza.tvwrote:
>>Sorry Anthony but I couldn't exactly understand what are you trying to
say. Could you please be bit more specific on what you are trying to
say?
Due to the nature of server side includes being processed before the asp
is processed, you can't use this kind of conditional server side includes.

He shows that the page loads both includes first, and then the server
executes the ASP.

Have a look at this:http://www.4guysfromrolla.com/webtech/022504-1.shtml

Steve

OK....fine.....I got it. The bottomline is ALL include files will be
processed (before any ASP code in the ASP page with the includes is
executed) & included in the ASP page irrespective of whether the
include files have been included conditionally or not. Depending on
the If.....Else condition, the appropriate output will be spat out.

Correct?
Correct :)

Steve
Dec 18 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil | last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server: class HelloWorld: _reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}" _reg_desc_ = "Python Test COM Server"...
6
by: Nathan Sokalski | last post by:
I want to set up SQL Server on Windows XP Pro so that I can use the database capabilities of ASP and IIS. I am probably using some incorrect settings, but I am not sure what they are. Here is what...
9
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
0
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: ...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
4
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
14
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.