Skip navigation
LadyFulton
Currently Being Moderated

Server Side Includes

Apr 26, 2012 11:44 AM

I need to know how to get rid of a server side include with a corrupted path.  I included a header1 file but it never functioned properly, now I need to get rid of it and create a new Sever Side Include file for a new header and I need to create one for the footer also. 

 

Also, On my index page inside dreamweaver, ever since I added a server side include, I can no longer edit the page.  In design view it only shows me the header and in live code view it shows me the entire page but it is not editable in LiveCode view. 

 

I know it must be something simple I am doing but I have not figured it out.  I need to change the header again and the footer and I am so tired of uploading each page individually, I need an Include to reflect on every page. 

 

But first I need to get rid of the SSI that isn't functioning correctly and I need to be able to edit my index page again.  Can someone please help?

 
Replies
  • Jim Carpenter
    546 posts
    Apr 6, 2006
    Currently Being Moderated
    Apr 26, 2012 11:50 AM   in reply to LadyFulton

    If you can provide a link to the problem page, there are several that can help you with your problem. If this is on a page that relies on a template, it might be just a markup error.

     

    I don't think you will get much help without a link or unless you provide the page code.

     

    Jim

     
    |
    Mark as:
  • Jim Carpenter
    546 posts
    Apr 6, 2006
    Currently Being Moderated
    Apr 26, 2012 12:14 PM   in reply to LadyFulton

    with a .html extension probably will not process a SSI. When  you create a SSI, make sure it doesn't contain a <html><head><title><body></body></title></head></html> tags. You only need to include the html that you want to display at the point of insertion.

     

    So an example, and forgive me if you already understand this, is a header include that only has your image logo.

     

    So the only thing in this include file would be (code view):

    <a href="/"><img src="/images/myLofo.png" alt="My website" width="180" height="90" class="logo" /></a>

    This would be saved with a file name of header.inc.asp, in a folder off your root called includes

     

    Then  you would include it like so:

    <!--#include virtual="/includes/header.inc.asp" -->

     

    As to not being able to edit the page, strange things have happened. So open up the index page, do a save as and call it index2.html, Then copy in code view everything, from top to bottom. Open a new document, go to code view and replace everything with a paste of your old page code. Do a save as and save this as index.html

     

    See if you can edit this version. Make sure  you backup your previous version (thus the save as index2.html) so if need be, you can restore. I have had pages that gave me an error before and this was a fix that I was able to do.

     

    Jim

     
    |
    Mark as:
  • Jim Carpenter
    546 posts
    Apr 6, 2006
    Currently Being Moderated
    Apr 26, 2012 12:22 PM   in reply to Jim Carpenter

    Looking again at your page that you linked above, I see this in the code: <!--#include file="header.html" -->

    If you look at that file, it is a whole page, with <html><head><title> etc, and that cannot happen as it places two of these in each page that the include is in, You can only have one of these in each webpage and that might be where your problem is. It will showup in DW, as it will show the include file, but it will not show up on the webserver, because with a .html extension, it doesn't parse the include file (you would have to use a .shtml extension)

     

    Jim

     

    UPDATED: To be able to edit the page in DW,  you need to delete this line in code view: <!--#include file="header.html" -->

    That is what is hosing up  your editing and the reason you are getting a gray box.

     
    |
    Mark as:
  • Jim Carpenter
    546 posts
    Apr 6, 2006
    Currently Being Moderated
    Apr 26, 2012 12:36 PM   in reply to LadyFulton

    To get back where you can edit the page, I updated above, but here it is again. I was able to create your problem and resolve it:

     

    UPDATED: To be able to edit the page in DW,  you need to delete this line in code view: <!--#include file="header.html" -->

    That is what is hosing up  your editing and the reason you are getting a gray box.

     
    |
    Mark as:
  • Jim Carpenter
    546 posts
    Apr 6, 2006
    Currently Being Moderated
    Apr 26, 2012 1:12 PM   in reply to Jim Carpenter

    SSI is the best way to do what you want. You cannot use .html unless you talk to your web provider and see if it will set it up to process the includes with a .html extension. You are probably hosting on IIS, if it is Apache, you could do this if you have access to your .htaccess file. I don't know what type of hosting you have. One simple call or email could answer that to your hosting company.

     

    I hope this helps.

     

    Jim

     

    MORE: It looks like you are hosted on an Apache webserver. If you can access your control panel, you can setup the .htaccess to process html with a couple of lines in it. You could log into your .htaccess editor from the control panel.

     

    You would need to ADD this to your .htaccess:

     

    AddType application/x-httpd-php .htm

    AddType application/x-httpd-php .html

     

    That way, html would be process as PHP.

     

    IMPORTANT:If you add the two lines above to your .htaccess file, make sure you delete

    <!--#include file="header.html" -->

    on the file on the webserver, otherwise, you will have the same problem online and nobody will be able to see your website.

     

    Message was edited by: Jim Carpenter

     
    |
    Mark as:
  • Jim Carpenter
    546 posts
    Apr 6, 2006
    Currently Being Moderated
    Apr 26, 2012 1:17 PM   in reply to Jim Carpenter

    MORE: It looks like you are hosted on an Apache webserver. If you can access your control panel, you can setup the .htaccess to process html with a couple of lines in it. You could log into your .htaccess editor from the control panel.

     

    You would need to ADD this to your .htaccess:

     

    AddType application/x-httpd-php .htm

    AddType application/x-httpd-php .html

     

    That way, html would be process as PHP.

     

    IMPORTANT:If you add the two lines above to your .htaccess file, make sure you delete

    <!--#include file="header.html" -->

    on the file on the webserver, otherwise, you will have the same problem online and nobody will be able to see your website.

     

    Message was edited by: Jim Carpenter

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points