Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why is this working (include files) 2

Status
Not open for further replies.

crystalized

Programmer
Jul 10, 2000
390
CA
Include files are "pasted" in before code is processed right? At least that is what I thought I had read several times. So then why is this working?
Code:
<%  if not browserCheck() then %>
<form >
<table width=&quot;1&quot; border=0 cellspacing=1 cellpadding=1>
<% else %>
<!-- #include file=&quot;../MainPagesIncludes/headingDivs.asp&quot; -->
<table id=&quot;contentDiv&quot; WIDTH=&quot;1&quot; BORDER=&quot;0&quot; CELLSPACING=&quot;1&quot; CELLPADDING=&quot;1&quot;>
<% end if %>

To clarify what I am doing my browserCheck() function just checks for IE browser. So when I view the page in IE I see the heading provided by the include file headingDivs.asp. In NS I do not see the heading (which was the goal). But doesn't this counter the fact that includes are done first then code is processed? Or am I wrong in my interpretation of when the include files are infact included?
Crystal
crystalized_s@yahoo.com

--------------------------------------------------

Experience is one thing you can't get for nothing.

-Oscar Wilde

 
Crystal,

You are right, include files are processed prior to asp code. And your code is doing exactly what it should.

Here are the steps taken in your code:
1. Include file processed, assuming header is WELCOME!

<% if not browserCheck() then %>
<form >
<table width=&quot;1&quot; border=0 cellspacing=1 cellpadding=1>
<% else %>
WELCOME!
<table id=&quot;contentDiv&quot; WIDTH=&quot;1&quot; BORDER=&quot;0&quot; CELLSPACING=&quot;1&quot; CELLPADDING=&quot;1&quot;>
<% end if %>

2. asp.dll takes over and spits out html code, based on your if-then-else statement.

IE will always see heading and NS won't, whether the heading is included or hard-coded.

I hope I made myself clear. Just try to process the code as if you are a compiler and you'll see what I mean.



Choo Khor
choo.khor@intelebill.com
 
Dear Crystal,

Choo Khor is correct. Actually Crystal, you answered your own question:

> Include files are &quot;pasted&quot; in before code is processed right?

<!-- #include file=&quot;../MainPagesIncludes/headingDivs.asp&quot; -->

Try copying the code from that file and pasting it inplace of the include comment. It will run exactly the same.

-pete

 
Duh

Sorry, I guess that I am feeling just a little bit stupid right now. We can only hope that I was tired at the time of writing the above. LOL

Well well what do we live for but to make sport for our neighbors and to laugh at them in our turn (Pride and Predjudice)
Crystal
crystalized_s@yahoo.com

--------------------------------------------------

Experience is one thing you can't get for nothing.

-Oscar Wilde

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top