Forum Moderators: open

Message Too Old, No Replies

ASP Include File, Content is showing on top of header

         

SylvieS

1:04 am on May 20, 2004 (gmt 0)

10+ Year Member



I am new with ASP, I have learn ASP.NET 2 years ago but haven't use it since, I am a bit rusty... For the first time I am using includes file but I'm having a small problem.

I have created a Header.inc file and a Footer.inc file

The Header.inc contains the logo of the site and the navigation menu on the left. I want the content of my page to be INSIDE the Header, so when I write <p> Hello World </p> it will show below my header and on the right of navigation menu (common sense!) In my case, the Hello World is all showing at the top of everything of my page...how can I put in inside the Header or at the place I want it to be?

Here's my code below: What I'm a missing?

<html>
<head>
<title>SPD Website</title>
<link rel="STYLESHEET" type="text/css" href="includes/main.css">
</head>
<body>
<!--#include virtual="Spdsite/Header.inc"-->

<!-- CONTENT BEGIN HERE -->

<p>Hello World</p>

<!-- CONTENT END HERE -->

<!--#include virtual="Spdsite/Footer-en.inc"-->
</body>
</html>

Thanks

Sylvie

WebJoe

11:46 am on May 20, 2004 (gmt 0)

10+ Year Member



The code as you posted it looks ok. From my experience (I have my pages the same way) there's probably an html-error in your header- or footer-file, or your main page is not as simple as you posted an there's a table for positioning that has some html-error

DaveN

11:47 am on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<!--#include file="Spdsite/Header.inc"--> try that

defanjos

1:09 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am assuming the header.inc has a table in it. If it does, you have to make sure to open the table on the header and close it on the footer.inc.

For example, a very simple example:

HEADER:
<table>
<tr>
<td>

FOOTER:
</td>
</tr>
</table>

That way the "Hello World" will show.

I personally don't like that way of doing includes, I like to have one block of code for the header, one for the content and one for the footer.
For example:

HEADER:
<table>
<tr>
<td>
Header content
</td>
</tr>
</table>

CONTENT:
<table>
<tr>
<td>
Page content
</td>
</tr>
</table>

FOOTER:
<table>
<tr>
<td>
Footer content
</td>
</tr>
</table>

defanjos

1:23 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another thing to look for, is that you might have a <head> or <body> tag on the include file, that will mess things up.

Easy_Coder

4:14 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<!--#include virtual="/Spdsite/Header.inc"-->
note the slash in front of Spdsite

SylvieS

7:39 pm on May 26, 2004 (gmt 0)

10+ Year Member



Thanks everyone for your help... sorry for not responding before, but I was busy.

I was able to fix my problem, in fact, my header had a lot of tables and I had to go thrue each of them to make sure there where closed properly, it was a real mess! Now that I have clean it up, it's all working fine and my includes are connecting properly!

Thanks :-)