Copy link to clipboard
Copied
Hey, Im trying to make a separate file for a global navigation bar using Server Side Includes in Dreamweaver cc 2018.
When I preview my index.html file I get the menu that I included, but if I try to use it to get to another page like "About Us" it doesn't appear on the new page... However if I click "preview in browser" for the About Us page, the menu apears again...
Is it a problem that all my files have the ending .html?
Or is it something that will happen in DW but wont happen when I uploade my site?
Is your server configured to parse includes in SHTML files?
I seem to remember that I had to configure it myself in WAMP and on my remote server.
I so rarely use SHTML files, I do everything in PHP now. PHP includes and .php files.
Copy link to clipboard
Copied
If you are using...
<!--#include file="included.html" -->
...all of your pages that have an include on them should end in .shtml
If you are using...
<?php include 'path-to-include-file.php';?>
...all of your pages that have an include on them should end with .php
Either way, you should set up a local testing server in DW to handle the includes for you during development.
Copy link to clipboard
Copied
Thanks! I did that, but now I dont get the include at all...
I made a php MySQL server and put it in the "www" folder in wamp.
my index.shtml file looks like this:
<!doctype html>
<html>
<head>
<title>Name</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<!--#include file="menu.html"-->
hello world!
</body>
</html>
and my menu.html file looks like this:
<ul>
<li><a href="index.shtml">Home</a></li>
<li><a href="geologyngeophysics.html">Geology & Geophysics</a></li>
<li><a href="exploration.html">Exploration</a></li>
<li><a href="fieldncourses.html">Fieldwork & Courses</a></li>
<li><a href="researche.html">Researche</a></li>
<li><a href="management.html">Management</a></li>
<li><a href="aboutus.html">About Us</a></li>
</ul>
Copy link to clipboard
Copied
By your description, it would seem you're previewing locally with Temporary Files. Thus when you preview the page directly, you see the includes but you don't see includes when navigating to other pages.
Copy link to clipboard
Copied
Thats right!
Does that mean that this wont be a problem when i upload the site to my webhost/webhotel?
Copy link to clipboard
Copied
Is your server configured to parse includes in SHTML files?
I seem to remember that I had to configure it myself in WAMP and on my remote server.
I so rarely use SHTML files, I do everything in PHP now. PHP includes and .php files.
Copy link to clipboard
Copied
I dont know, Ill have to ask my webhoast about that and if they can change the configuration for me.
Otherwise I could do as you and use PHP.
Thanks!
Copy link to clipboard
Copied
If you changed all the file extensions of your pages to .shtml, your links in the code posted above are wrong.
They would need their .html changed to .shtml as well.
Copy link to clipboard
Copied
It's not difficult to add the SHTML file type with an .htaccess file.
Enable SSI with .htaccess - Apache .htaccess Guide, Tutorials & Examples
Nancy