PDA

View Full Version : Server-side include not working - driving me bananas


Binky
07-07-2008, 04:52 PM
I created a number of pages using includes for a menu, submenu, and footer. File extension is shtml. All worked as expected. Then I created a sub-directory and made more pages with includes. None of the includes work. [an error occurred while processing this directive]

Nothing I've tried will get them to work. I've tried changing the include from ../menu.inc to adding the full path, http://domain.com/menu.inc, to copying the include to the subdirectory.

When adding the include in Dreamweaver, they show up correctly in Dreamweaver. I've been messing with this for hours and can't see what I'm doing wrong.

I just uploaded test.shtml to http://folkmusichistory.com/outline/test.shtml

Here's the source code<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
<!--#include file="menu.inc" -->
</body>
</html>menu.inc is in the same directory. Can anyone explain why this won't work?

Randall
07-07-2008, 05:22 PM
The include file isn't where you think it is -- there's no menu.inc file in that directory.

(edit: Yeah, like Arthur says. :wink:)

Randall

Arthur
07-07-2008, 05:22 PM
I don't see that menu.inc is located in the outline directory. Anyway, you can't use absolute file paths, nor "../" when you use file (but you can use /menu.inc when the file is in the document root). You can do this with virtual though. Examples: <!--#include virtual="../menu.inc" -->
<!--#include virtual="/big/dom/xdomain/www/dir/menu.inc" -->

-Arthur