PDA

Click to See Complete Forum and Search --> : Including files in ASP


Sep 14th, 2000, 10:07 AM
Hi, I'm new to this, so please take that into account.

Anyway, I am trying to include different sorts of files into my ASP-file. A colleague of mine has written some jsp code that I want to include. So after the <meta> tag, I type: <!--#include file="swapfunctions.js"-->

The result is that it includes the functions, and I can even use them, but if I view the source code in IE5, I see the functions there twice. I'd like them only to appear once (or not at all).

But at least that part works. A little further on, after the <body> tag, I use the same header for every page, so I also wanna include this header. It is made up of a table in which an image is displayed, along with some "text"-images that work as links to other pages.

So I type: <!--#include file="main_navigation.asp"-->
The result when I watch it in IE5 is that I get the header TWICE, which is of course absolutely not what I want.

If anybody knows how to solve this (and I'm sure it's pretty easy, I just don't know what it is, considering I'm new at this), will you please let me know?

Many thanx in advance,
Marcel
m.boeren@euro-partners.nl

asabi
Sep 16th, 2000, 01:13 AM
well it sounds to me as if you have 2 files that include the same file (each).

Example:

if I have members.asp and in it I include userinfo.asp
and then I have logout.asp which also include userinfo.asp

I think that what you do is something like:

in index.asp you include both members.asp and logout.asp (and each of them include the userinfo.asp)

this will cause userinfo.asp to apear twice ...

check your code and make sure you don't have this case ..

Sep 18th, 2000, 02:15 AM
Well, it doesn't seem to be the case that I include things twice. Because in my index file I do absolutely nothing (but call the main page), and here's what the (stripped) first part of my code for the main page looks like:

<html>
<head>
<script language="javascript" src="swapfunctions.js">
</script>
<!--#include file="styles.css"-->
</head>
<body>
<!--#include file="main_navigation2.asp"-->
<table... blah blah..

When I look at the code when displayed in IE5, I see the style sheet twice, and then later on the table is shown twice aswell.

In my "main_navigation2.asp", I just have a table defined, starting with <table> and ending (of course) with </table>

If I copy the ocde from main_navigation2.asp into the main page, it displays the table just once. So if the problem would be that I would have included it twice, wouldn't it still display it twice when I'd watch the source code from IE5?

asabi
Sep 18th, 2000, 02:44 AM
Well, I don't see sny reason for that to happen than ..

if you like, you can send me the code for all 3 pages (you can strip out all the things that you don't want any other human being to see :-) and I can try to figure it out.

at least send most of it so I can get a better picture of what's going on there ..

remember, the computer never makes mistakes, humans makes mistakes ..