bhanu_pratap — 2012-05-24T13:39:04-04:00 — #1
i don't know it is the right category to post this thread or not but it is related to web design so i am putting my query here.
My trouble is:
I have a website thoughtfulminds (dot) org, It is completely made in HTML and out of 94 pages 90 are indexed in Google. Now since this website is in HTML if now i have to make any changes like i have to add any services or change any link i have to get all the pages in Dreamweaver and do the changes in header or footer section.
So, i want to make a header and footer file and want to include it in my website. I have tried several ways like used object tag but it creates scroll bar and is now worth using.
Secondly i also used <!-- include virtual ...> this tag but it also didn't worked for me.
So i want to know how can i make a header and footer file and include it in my HTML pages ????
parkint — 2012-05-24T13:56:27-04:00 — #2
The SSI (Server Side Include) should work for this; depending upon your server configuration.
Of course, this will still require loading/editing every single page in order to apply the changes.
Double-check the way you implemented (or tested) the SSI. Here is a good example I found from a web search.
bhanu_pratap — 2012-05-24T21:00:47-04:00 — #3
Yes, you are right i was talking about the SSI method it looks promising but i tried this method it didn't worked for me
what could be the reason for this?? Why this method not working in my website
jessen — 2012-05-25T08:06:26-04:00 — #4
I know that you already have your pages in html format but I would suggest you convert it to PHP pages since you can just add some PHP script to it later on if you decide to and therefore make your site more future proof. You would also be able to use the code <?php include 'navbar.php'; ?> to each of your pages and just edit one file if you want to make a change on your navigation bar for example.
kduv — 2012-05-25T23:08:00-04:00 — #5
Assuming your server is running Apache and PHP, you can tell your server to parse all your .html files through PHP without changing all your file extensions.
Just add the following line in your root .htaccess file (depending on whether your PHP install is running as an Apache module or CGI mode):
# If PHP is running as a module
AddType application/x-httpd-php .html .htm
# If PHP is running in CGI mode
AddHandler application/x-httpd-php .html .htm
After you add the appropriate line, all .htm and .html files will be executed the same as if they were .php files. From there you can insert your headers and footers in your existing HTML files like so:
<head> <!-- HEAD CODE --> </head>
// Include your custom header file
<!-- Body Code -->
// Include your custom footer file
Then just create header.php and footer.php with whatever HTML you want inside, IE: navigation links, footer links, etc.