9 Replies Latest reply: Apr 26, 2012 1:17 PM by polar_bare RSS

    Server Side Includes

    LadyFulton Community Member

      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?

        • 1. Re: Server Side Includes
          polar_bare Community Member

          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

          • 2. Re: Server Side Includes
            LadyFulton Community Member

            http://www.accentawningco.com/index.html

             

            This is the link.  I can post the code, but it is not allowing me to copy and paste onto this forum.  Is there a way to do that so I do not have to type it by hand?

            • 3. Re: Server Side Includes
              polar_bare Community Member

              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

              • 4. Re: Server Side Includes
                polar_bare Community Member

                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.

                • 5. Re: Server Side Includes
                  LadyFulton Community Member

                  Jim-I tried the restore and the page in design view did not display properly at all, it did not shape up with the header or footer or menus.  I was promted at the end to update links, and I said no.

                   

                  How do I simply delete the SSI that is incorrectly pathed?  It is saved as a header.html and it is not in a file called includes, it is saved in the main folder with all the pages and simply called header.html. 

                   

                  The reason I would like to delete this is because ever since I inserted it into the index.html page, the rest of the page does not display unless it is in 'live view' and the page is not editable in live view, in design view it does not display, only the header.html displays.  I do not know which part of the code to delete to get rid of it in 'code view' because I fear seriously messing up the page beyond my repair.  I did not create this site, I am only editing it.  I would post the code but I cannot paste text into the forum for some reason.

                  • 6. Re: Server Side Includes
                    LadyFulton Community Member

                    Ok, that worked and I can successfully edit the page again. Thank you.  Now I need to properly create include files.  I followed the tutorial I found on the web to the letter, but it did not mention file extentions, so I chose the wrong one to follow.  I really appreciate your help.

                     

                    Should I delete the header.html file in the main folder since it holds no significance?  Will removing that line of code and deleting that file mess up the display of my page once it is uploaded back to the web?

                     

                    Should I just edit each page like I was doing?  Or is SSI the best way for me to do site-wide changes to the header and footer?

                    • 7. Re: Server Side Includes
                      polar_bare Community Member

                      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.

                      • 8. Re: Server Side Includes
                        polar_bare Community Member

                        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

                        • 9. Re: Server Side Includes
                          polar_bare Community Member

                          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