Hello all,

I just started working at a firm as a web assistant and was given the task of redesigning our site. One of my tasks involves making the site more efficient by using include files.

I have never designed with this in mind and despite my best research I can't figure out how to work these files. The images nor the text appears when I use the include files.

Can anyone diagnose the problem?

Compare the original at

http://cisr.jmu.edu/

with

the failure at

http://cisr.jmu.edu/development/

<html>
<head>
<title>CISR Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="CISR_main.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.footer {
	font-family: Tahoma, Geneva, sans-serif;
	font-size: xx-small;
	font-weight: bold;
}
-->
</style>
</head>



<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
	<form name="form1" method="post" action="http://www.picosearch.com/cgi-bin/ts.pl">
	<input type="hidden" name="index" value="159730">
<div id="banner">

[B]<!--#include virtual="../include/headInclude.htm" -->[/B]


</div>
<!--Home image -->

<div id="NEWS"><img src="homeimage.jpg"></div>

<!-- End Home image -->


<!-- Content Box -->
<div id="contentbox">
<!-- ImageReady Slices (CISR_home.psd) -->
<img src="topimage.jpg" width="802" height="182" alt="Content">
<!-- End ImageReady Slices -->
</div>

<!-- End Content Box -->

<!--Start Products & Periodicals Headlines -->

<div id="PRODUCTS">Products 
and Publications</div>
<br clear="all">
<div id="EVENTS">Check out our latest 
products<br> 
and publications.<br>
<br> 
Click an image to view 
more information about the featured <br>
item.</div>
<div id="guideimage"><a target="_blank" href="http://maic.jmu.edu/research/services/services.htm"><img src="guide-book-cover.jpg" width="110" height="97" border="0"></a></div>
<div id="GETI"><a target="_blank" href="http://maic.jmu.edu/research/services/services.htm">Land Mine Casualty Data: <br>
Best Practices Guidebook</a></div>
<div id="ATC"><a target="_blank" href="http://maic.jmu.edu/research/services/services.htm">Adapative Technology Catalog</a></div>
<div id="atcimage"><a target="_blank" href="http://maic.jmu.edu/research/services/services.htm"><img src="images/CDlarger.gif" width="110" height="97" border="0"></a></div>
<!-- End NEWS Headlines -->

<!-- End Content Box -->

<!--Start EVENTS and Announcements Headlines -->
<!-- End EVENTS Headlines -->

<!--Start More Highlights -->

<div id="HIGHLIGHTS">HIGHLIGHTS</div>
<div id="highlightsinfo">
  <p><font style="color:#CC0000" size="+1"><em><strong><a href="http://jmu.qualtrics.com/SE/?SID=SV_0DFEUoSUuLnWau8&SVID=Prod" target="_blank">READER SURVEY</a></strong></em></font> <br>
    <br>
  Tell us what you think about <br>
  <em>The Journal of ERW and Mine Action</em> in 15 minutes or less.<a href="/news/2010PCRW2010.pdf" target="_blank"></a></p>
<p>&nbsp;</p>
</div>

<!-- End More Hightlights -->

<!-- Footer -->
<div id="FOOTER">

	[B]<!-- #include virtual="footerInclude.html" -->[/B]

</div>
<!-- END Footer -->




<map name="Map"><area shape="rect" coords="104,-1,161,15" href="disclaimer.html" target="_blank" alt="Disclaimer">
</map></body>
</html>

Recommended Answers

All 12 Replies

Member Avatar for diafol

I assume this is SSI and not ASP. If so you file must end with the extension: shtml or stm or shtm.

And not every server is set up to use server side includes.
Which has annoyed me several times in the past.

@ ardav
There are include files on the server from the last web assistant that I presume aren't ASP files because they don't have the ASP extension.

Go to http://maic.jmu.edu. There are three SSI include files in the source. head, skyscrapper... These files work for some reason while mine don't. I'll investigate further later and get back to you.

@ drjohn
Luckily my server supports these kinds of files. I'll have to investigate further. Do you have any other suggestions?

Member Avatar for diafol

Got the url, but I don't know how this is supposed to enlighten us. The original calling code (SSI) is replaced by the content of the included files, leaving no trace of the what went on. Check your url references. I notice that in your posted code, there are a couple of different locations.

@ardav Yes i agree with you. I also feel about this code and it seems to be a SSI code!

@ardav
woops! didn't see what you were getting at but now I see that the code is just inserted without the reference. ok the original point was to see if there was some minor detail I was missing (looking at the same piece of code for hours leads you to think that you "know" it.)

Here is the code from the functioning site followed by the peculiarly coded include file called 'header':

<!--#include virtual="../include/stats.htm" -->
	<body>
	<!--#include virtual="../include/header.htm" -->
	<!--#include virtual="../include/skyscraper.htm" --><div class="container">
<style type="text/css">
<!--
#apDiv1 {
	position:absolute;
	left:752px;
	top:94px;
	width:0px;
	height:2px;
	z-index:1;
}
#apDiv2 {
	position:absolute;
	left:597px;
	top:19px;
	width:174px;
	height:84px;
	z-index:1;
	visibility: visible;
}
#apDiv3 {
	position:absolute;
	left:597px;
	top:21px;
	width:174px;
	height:78px;
	z-index:1;
	visibility: visible;
}
#apDiv4 {
	position:absolute;
	left:567px;
	top:20px;
	width:205px;
	height:80px;
	z-index:1;
}
-->
</style>
<div></div>
<div class="header"><a href="http://maic.jmu.edu/"><a href="http://maic.jmu.edu/"><a href="http://maic.jmu.edu/"></a><a href="http://maic.jmu.edu/"><img src="/images/MAIC/header/headerbackground.gif" width="765" height="91" border="0" usemap="#Map" />
        <map name="Map" id="Map">
          <area shape="rect" coords="576,4,742,86" href="http://cisr.jmu.edu/" target="_blank" alt="cisr" />
        </map>
</a></a></a></div>

I'm sorry if this doesn't enlighten you further.

Well, normally when I do includes my file extension is .txt or even .inc so there's no mistaking it for a full html page.

The link to the broken page is giving me a 'Directory Listing Denied
This Virtual Directory does not allow contents to be listed.' This tells me the broken page is either
1. is not named index or default
2. is not there

But without having copies of the files for both the working version and the non-working version, there's not enough info to do much helping.

Advice:
1. make sure your main file is named index or default and has the proper extension. (Some servers will only serve up index.htm or index.html as default pages when the full address is not given.)
2. make sure the directory you're using for testing allows for includes.
3. make sure your links to the includes are correct AND the code inside them is valid.
(The code inside the 'header.htm' has some issues - nested hrefs among other things.)

How can I make sure that the directory that I'm using allows includes? I maintain two main sites that share the same server so I would assume it does but I can't be sure.

"The link to the broken page is giving me a 'Directory Listing Denied
This Virtual Directory does not allow contents to be listed.' This tells me the broken page is either
1. is not named index or default
2. is not there"

Does this mean that I NEED to have a directory with an index for include files to work? Is that a requisite?

The link http://cisr.jmu.edu/development/ lead me to an error page since the server is automatically looking for an index file since no file name was given in the link.

Server gets request for 'development/' Server looks at its personal setup file and goes 'Aha I'm suppose to look for index.htm, index.html, default.htm, or default.html. Oh, wait, I can't find any of those and I'm not supposed to show the file structure. Oops.'

Without looking at the broken file(s) and seeing what the server says is wrong, we can't do much.

But:

If the main file is being rendered with warnings like 'error, cannot include file such and such' then includes are being allowed but the include file is either in the wrong place or misnamed (If the file being included was a Perl script then I'd also be looking at the error log for why the script failed.).

If there is no such warning but it's obvious the include file was NOT included then your directory does not allow them and you need to talk to whoever is in charge of the server and ask them to verify that includes are allowed in your development directory.

The other thing you can do give your main file a .shtml extension and see if that works. .shtml IS the normal extension for pages using includes. IF your development directory allows includes then that is your best bet.

Ok so that's strange that it won't come up. The home page in this directory is default.html.

Try this link:
http://cisr.jmu.edu/development/default.html

The SSI isn't giving me an error (although it has when I tinkered around with the include file itself), its just not showing.

Thanks for your help Dandelo! Really appreciate it!

Okay - it threw an error when you moved or tinkered with the include file - but when I look at the source I see the include comment - which means it's not processing the command. Change the file extension to .shtml or .shtm (those are the normal defaults for pages using SSI. If that doesn't work - talk with your IT people to get SSI activated for that directory.

Thanks for your help! I had tried using the shtml files to do this but applied it to the include files! Carelessness and wasted hours...

Thanks again!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.