Forum Moderators: phranque

Message Too Old, No Replies

Ssi

Not working

         

rominosj

8:21 am on May 26, 2004 (gmt 0)

10+ Year Member



Hello,

I am trying to put my menu in a header.htm file to be calle by SSI, but when the page loads only the text comes up, and the menu is not shown.

The server is fine because other ssi is working.

What could be wrong? Below is the head, ssi, and part of the body text:

--------------------------------------------------------<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" language="JavaScript1.2" src="/stm31.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW ¦¦ innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
.style1 {font-family: Tahoma}
-->
</style>
</head>
<body>
<p>&nbsp;</p>
<p>

</p>

<!--#include virtual="/header.htm"-->
<div id="Layer2" style="position:absolute; width:328px; height:606px; z-index:2; left: 183px; top: 18px; font-family: Tahoma;">
<p><span class="style5 style7">My Content</span><span class="style4"> </span> </p>
<p align="left">a bunch of text </p>
BODY CONTINUES....
------------------------------------------------------
Thanks,

Romino

[edited by: jatar_k at 5:03 pm (utc) on June 8, 2004]
[edit reason] removed specifics [/edit]

stuartc1

11:24 am on May 26, 2004 (gmt 0)

10+ Year Member



Is there any connection to PHP in this? I don't mean to be smart, but it may help with your question if you explain how all the pages hang together and what names they are called.... also the server type may help.

disoft

12:06 pm on May 26, 2004 (gmt 0)

10+ Year Member



Just asking the obvious here, but have you named your page correctly (i.e. .shtml) so that SSI is processed?

rominosj

3:17 pm on May 26, 2004 (gmt 0)

10+ Year Member



I just didn't know where to post it, so I chose PHP Server side scripting.

I did not do the shtml, please tell me how to go about that.

thanks,

romino

Philosopher

3:23 pm on May 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You simply need to rename the page where the SSI call is on to .shtml. This tells the server that is needs to parse the page for SSI calls.

So rename the page where the html you cut & pasted from is found to whatever.shtml and try it that way.

Mr_Brutal

3:24 pm on May 26, 2004 (gmt 0)

10+ Year Member



I don't know whether it true in this case but i often haven't set up my web server with the correct virtual directories so instead of using:

<?php include virtual="/header.htm"?>

I use

<?php include file="/header.htm"?>

this would assume your header.htm fiel is in the same place as the page that is calling it. Er i haven't explained that very well, but you should get the idea its a mistake i make alot so i thought i'd suggest it!

rominosj

6:21 am on Jun 8, 2004 (gmt 0)

10+ Year Member



thanks philosopher it worked!

SSmeredith

9:06 pm on Jun 10, 2004 (gmt 0)

10+ Year Member



Mr. Brutal,

those tags aren't working for me at all. Regular SSI is working, i've tested it already but I need to use PHP because i can't change all the file' extensions. I'm told by the host that my php isn't right. can you tell me what needs to be placed in the .htaccess file?

here's the error page:

this is using the tag you offered. i got a longer error with another variation.

Mr_Brutal

8:38 am on Jun 14, 2004 (gmt 0)

10+ Year Member



SSmeredith,

The reason those tags aren't working for you are because i'm an idiot and am mixing my ASP and PHP :-)

<?php include("file.php");?>

where file.php is in the same folder as the file with the include statement.

You've probably solved this by now but i thought i'd acknowledge my stupid answer above :-) If your SSI is working thats the correct PHP and your .htaccess won't need anything else.

HTH

SSmeredith

11:29 am on Jun 14, 2004 (gmt 0)

10+ Year Member



Hi Brutal,
Thanks for the reply. No problem, after looking all over the place the tag that finally worked for me was this one:

<? include 'header.php';?>

Which is what you posted above. And voila! it worked. What a relief to do change these statics one last time like this.

Now, I've just come across this problem. Using this tag in a second level file isn't working. I tried using the same tag and even added the include files in the same folder but to no avail :(

Could it be something in the .htaccess file?

Thanks,
M

Mr_Brutal

3:43 pm on Jun 14, 2004 (gmt 0)

10+ Year Member



Hi again,

I'm no expert (consider me a junior :-) ) but i really don't think its your .htaccess file, what i would suggest is looking up the "require" function as well as "include" both here at WebMasterWorld and on the rest of the net.

I've only just started using PHP and this is an area i need to research some more as well.

Seya

Philosopher

3:48 pm on Jun 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is currently happening?

Are you getting an error? If so, what is the error?

Is the php include statement simply not getting parsed (is it still in the code when you view source)?

SSmeredith

4:26 pm on Jun 14, 2004 (gmt 0)

10+ Year Member



okay, to reach a 3rd level file i just included an absolute path like this

<? include 'http://mysite.com/header.php';?>

and it worked fine. But the first page i tried this, a second level index file won't work for anything. I have noticed though, it has a form on it but the page isn't a cgi file. And i didn't have a problem with a similar page on a root level.

And no, it's just not parsing. i even tried placing a copy of the file in the same folder just to see if it would parse and no luck there either....

[216.157.133.218...]

i'll be changing the ip to a domain after i've fixed it.

brutal, i'll look up those as suggested. thx.

Philosopher

4:38 pm on Jun 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ahh...yes I see.

First, you may wish to edit your post to get rid of the URL as it is against the TOS.

Second, it looks like your server simply isn't set up to parse files with a .html extension for PHP commands which is why your include statement isn't working. The server sees the file as a regular html file and doesn't try to do any parsing of the file at all.

You have two choices...

1 - You can change the file to .php and it will work

2 - Make a change in your .htaccess file so that .html files are parsed for php commands.

AddType application/x-httpd-php .html

in your .htaccess should do the trick.

Just curious, you said that the other includes in your third level work. Do they have the same file extension? Just wondering why they were parsed and not this file.

SSmeredith

5:07 pm on Jun 14, 2004 (gmt 0)

10+ Year Member



tada - you wouldn't believe the simplest things that stump me.

here's the code i had in the .htaccess file and you can see where i added the .html

Options +Includes
AddType application/x-httpd-php .htm .html

i guess it's too late to edit my post, the link is gone - sorry moderator, so harm intended.

and a big THANKS! phil

Philosopher

5:29 pm on Jun 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad that I could help!