0

I decided to put my navigation section into another file and retrieve it via html includes, so it will be easier to service if changes need to be done , as the navigation section is shared amongst several sites.

My index site used to work well, but now that i'm using the include method the navigation doesnt show.
Where is the mistake ?

my index.html

<!DOCTYPE html>
<html>
<head>
    <title>Home</title>
    <meta http-equiv="Content-Type" content="text/html; charset="UTF-8">
    <link rel="icon" type="image/png" href="favicon-32x32.png" sizes="32x32" />
    <link rel="stylesheet" href="style.css">
    <meta name="viewport" content="initial-scale=1">

</head>
<body>
<!--#include file="topnavibar.shtml" -->

<div class="maincontentHome">
    <img id="Banner" src="Banner3.gif" alt="Banner" >
    <div class="maincontentpic"></div>
     <div class="clearer"></div> 
</div>

and my topnavibar.shtml

<div class="topnavibar">
    <div id="flags">
        <img onmouseover="bigImg(this)" onmouseout="normalImg(this)" onclick="goToAUT()" src="AT.png" height="20" width="20" alt="AUTFlag" />
        <img onmouseover="bigImg(this)" onmouseout="normalImg(this)" onclick="goToGB()" src="GB.png" height="20" width="20" alt="GBFlag" />
    </div>
    <div class="menubar1">
        <a href="index.html">Home</a> 
        <a href="Unsere Philosophie.html">Unsere Philosophie</a>
        <a href="Ueber uns.html">&Uumlber uns</a>
        <a href="Portfolio.html">Portfolio</a> 
        <a href="Kontakt.html">Kontakt</a> 
        <a href="Partner Sites.html">Partner&nbsp;Sites</a>
    </div>
</div>

Thx for any help !!!!!

3
Contributors
10
Replies
43
Views
2 Years
Discussion Span
Last Post by Latrell_vie
Featured Replies
0

You might want to have a look at HTML Imports.

The directive you have used is a server-side include, which may need enabling on your web server in order to work. Note the 'file' or 'virtual' argument of the include directive should specify a path somewhere inside the web root directory. If you are hoping to share the file between sites I guess you might want to consider hard linking to or copying the file instead.

0

The index.html needs to be index.shtml. Unless there are SSIs inside the included files, they don't need to have shtml extensions.

Edited by diafol

0

I'm unable to find any mention of SSI on your host's site. To test whether SSI is enabled you could try something like outputting the date - just insert <!--#echo var="DATE_LOCAL" --> into the body of your document.

0

i just chatted with one.com. They said SSI is included , anyways i tried it with php now

<body>
<?php 
    include("topnavibar.php");
?>

...

</body>

but when i enter developers tools the inspect elements the php is in comments therefor not valid, why ?

 <body>
    <!--?php 
        include("topnavibar.php");
    ?-->

    ...

    </body>
0

After some internet surfing i found the solution, I only had to change the index.html to index.php and link them by redirection. Now my php snippet is working

0

You should have been able to use ssi. Did you try index.shtml? What does link them by redirection mean?

0

link them by redirection meant that if you type index.html in the browser you will automatically reach index.php through my modification.

Anyways i'm using my html pages now and added AddHandler server-parsed .html into my .htaccess so html pages will be parsed for SSI includes. Problem solved

2

OK, perhaps if you post your solution as it might help others facing a similar issue.

2

Okay i just entered

1)

<body>
    ....
    <!--#include file="topnavibar.html" -->
    ....
</body>

into the part of the html body where i want the topnavibar.html to appear

2)in your case just enter <!--#include file="myOwn.html" --> and pay attention to exact same spacing of the letters !!!
3)then, create a .htaccess file in the same directory as your files with ordinary texteditor (google as some editors aren't appropiate, but most are) and dont forget the dot before access !!!
4) into that .htaccess file enter following code :

AddHandler server-parsed .html

5) Now all your html pages will be parsed as shtml and the include line i posted in point 1 which is shmtl code will now work

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.