Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Please HELP!!! SSI Nightmare

    Ok.

    I have an entire site already designed.

    I want to go back and add includes for my navigation and footer so I can stop the nightmare of having to update 50 pages for one change to the navigation.

    I did a test page with both SSI and PHP includes. They worked. However:

    1. In order to work with php, all my pages need a .php extension.

    1. In order to work with SSI, all my pages need a .shtml extension.

    Like I said--the site is already complete. It would mean a complete overhaul to go and change all the name extensions/associated hyperlinks.

    Is there any way to get includes to work on .html and .htm pages?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Yes you can use htaccess. Here is an example for making all pages parse as php
    Code:
    AddType application/x-httpd-php .htm .html
    To make all pages be parsed by the server so you can use SSI (the includes you would have used on an .shtml page) you can use this
    Code:
    AddType text/html .shtml .shtm .htm .html
    AddHandler server-parsed .shtml .shtm .htm .html
    I would like to add though that this was poor design practice. Having that many pages without includes was non sense to begin with. You should think things through before you do them.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,037
    Thanks
    2
    Thanked 316 Times in 308 Posts
    I would venture a guess that each of your 50 pages are almost identical and only differ in the content that is on each page?

    If so, this is an ideal candidate for having one page of code using php and simply displaying the different content by having php populate it from a database depending on what navigation link is selected.

    If you are going to go through the trouble of modifying each page to change headers, footers, and navigation to use includes, why not put that same amount of effort and time (or it could actually be less) into reducing it to one page with the different content for each page being stored in a database.

    If this is something like repetitive product or any other repetitive information display, you will end up saving yourself a lot of time long term by doing it this way.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •