.aspx include question (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


fearnosurf -> .aspx include question (11/4/2005 15:12:20)

I'm having issues getting the <!--#include virtual="../0_common_files/masthead.htm"--> at the bottom of this code to function as intended. On this page is the masthead of the site, and .aspx will not correctly recognize the path to the image.

page code
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="test.aspx.vb" Inherits="testclients.cc_test" %>
<%@ Register TagPrefix="uc1" TagName="test_content" Src="test_content.ascx" %>
<%@ Register TagPrefix="uc1" TagName="test_rightNav" Src="test_rightNav.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>cc_pe_mockup</title>
		<meta content="Microsoft FrontPage 6.0" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<link href="includes/site.css" type="text/css" rel="stylesheet">
		<script type="text/javascript" src="includes/nav_functions.js"></script> <!-- this is the only addition that should need to be added to existing head sections -->
	</head>
	<body>
		<form id="Form1" method="post" runat="server"> <!-- this tag should be added to all existing pages -->
			<table height="0" cellspacing="0" cellpadding="0" width="760" border="0" id="mainTable"> <!-- you will need to replace your line with this one -->
				<tr>
					<td width="100%">
						<div align="left">
							<table cellspacing="0" cellpadding="0" width="100%" border="0">
								<tr>
									<td width="760">
										[font="Times New Roman"] <!--#include virtual="../0_common_files/masthead.htm"-->[/font]
									
									</td>
								</tr>


Masthead code
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>MASTHEAD - Graphic</title>
</head>

<body>

<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#660000" style="border-collapse: collapse" bordercolor="#111111">
  <tr>
    <td width="100%" valign="middle" align="center">
      <p align="center"><map name="FPMap0">
      </map>
      <img border="0" src="images/masthead_copyright.jpg" usemap="#FPMap0" width="760" height="125"></td>
  </tr>
</table>

</body>

</html>



Instead of using the correct path images/masthead_copyright.jpg" it pulls the following location (**Note this is from the .aspx page that Calls the include**)

http://www.website.com/clubname/aspx/images/masthead_copyright.jpg


As you see it thinks that the masthead resides in the aspx folder, when in fact it does not, the masthead resides ../0_common_files/images/masthead_copyright.jpg


My site structure is as follows:

domain/0_common_files/masthead.htm
domain/0_common_files/images/masthead.jpg
domain/aspx/test.aspx




rdouglass -> RE: .aspx include question (11/4/2005 15:41:56)

quote:

<!--#include virtual="../0_common_files/masthead.htm"-->


You don't need to access parent paths (../) when using "virtual". When using "virtual", everything is relative to the root so no matter how deep your directory is, it should always be something like:

<!--#include virtual="/0_common_files/masthead.htm"-->

That make any sense?




fearnosurf -> RE: .aspx include question (11/4/2005 15:43:04)

yes, but the include is pulling over fine. It's the image's path within the include that is causing me trouble.




fearnosurf -> RE: .aspx include question (11/4/2005 15:53:30)

btw I get the same issue whether I use
<!--#include virtual="../0_common_files/masthead.htm"-->
or
<!--#include file="../0_common_files/masthead.htm"-->




dpf -> RE: .aspx include question (11/4/2005 15:55:58)

but why not try the one rdouglass suggested?




fearnosurf -> RE: .aspx include question (11/4/2005 16:00:28)

quote:

ORIGINAL: dpf

but why not try the one rdouglass suggested?


It's not that I'm against trying it, I will. I was clarifying that the issue is the image within the include, not the include itself.




fearnosurf -> RE: .aspx include question (11/4/2005 16:06:01)

quote:

ORIGINAL: rdouglass

quote:

<!--#include virtual="../0_common_files/masthead.htm"-->


You don't need to access parent paths (../) when using "virtual". When using "virtual", everything is relative to the root so no matter how deep your directory is, it should always be something like:

<!--#include virtual="/0_common_files/masthead.htm"-->

That make any sense?


Tested, and the image within the include is still not displaying.




rdouglass -> RE: .aspx include question (11/4/2005 16:13:50)

quote:

Tested, and the image within the include is still not displaying.


Oh. I think I see now. Anything included in the include file will take on the property of the file that is including it. [&:] [&:] [&:]

Basically what that means is that once you include the file "masthead.htm", it now takes on the path properties of the original file not of where masthead.htm resides. Path data is determined from the highest "level" page when it comes to includes.

That help any?

Psst. You don't really want to use those parent path things in your virtual as well. [;)]




fearnosurf -> RE: .aspx include question (11/4/2005 16:37:32)

yes it does :/ unfortunately it means a bit of work.

We're only changing 2 sections of our existing Web sites over to .ASPX, and all of the pages have to be able to pull the masthead.htm include. SO without changing the path of the image to exact URL I don't know of a way to get this to work.




dpf -> RE: .aspx include question (11/4/2005 16:58:58)

why not just move the image?




fearnosurf -> RE: .aspx include question (11/4/2005 17:16:16)

Too many other pages rely on the image, and we want to keep the sites organized with all includes being in the same directories.




dpf -> RE: .aspx include question (11/4/2005 17:17:53)

well i understand the desire for organization but..you seem to have hit a wall. how big is the image? why not 2 copies? solves the problem




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625