Forum Moderators: coopster

Message Too Old, No Replies

SSI vs PHP

Before delving into understanding either I'd like some advice

         

nigassma

5:35 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



Quick recap of what my goal is:

I'm using a CSS/Javascript driven menu on a site. If changes are needed to be made I want to be able to make them accross the whole site without having to go into each individual page to make the changes one by one. The most logical way of doing this seems to do it server side.

My question(s) to you:
What would be the best, quickest and easiest way to do this.

I will keep the nav markup and css in it's own file. If I were to use an PHP would it need to be a .php file? Or would it be that every page that used the include need to be .php.

The site is hosted on an Apache server, and supports both SSI and PHP. I've heard that PHP is more flexible.

If I used PHP would <?php include="nav.htm"?> do the trick?

Since all my files are .htm right now would 'AddHandler server-parsed .shtml' still do the trick?

Thanks.

raimondious

6:22 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



PHP include paths need to be relative, so I would suggest using SSI. This way you can give the same absolute path on each page instead of having to change the path for pages in subdirectories and such.

'AddHandler server-parsed .shtml' won't work because only .shtml pages will be parsed. You will need to change it to 'AddHandler server-parsed .htm' if that's what all your pages are named. After that, you can use
<!--#include virtual="/absolute/path/to/include_file.htm" --> on each of your pages to pull in the nav and styles. (I would also suggest separating the nav markup and css into 2 files, and include the nav css with <link rel="stylesheet" type="text/css" href="/path/to/css.css" /> and include the nav with the SSI).

chrisjoha

8:10 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



There is also the possibility to do this with templates in Dreamweaver if you only need to collect similar content in one file.

nigassma

8:31 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



We're going to stay away from templates, since DW never seems to work well with them. SSI seems like the best answer so far.

similar content

We're not looking to collect info. Rather input it into every page. All the pages are already created.

TurboDan

5:57 am on Aug 19, 2005 (gmt 0)

10+ Year Member



I used to use ".shtml" files on all of my sites, but I switched them to PHP last year. I've found that it is easier and quicker to simply include using PHP, and that I can also use dynamic scripting and integrate it into my pages.

With SSI, I could include files, but not integrate my scripts properly. I just like having everything on one system.

jatar_k

4:00 pm on Aug 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



take a look at this thread
A dynamic site in 2 minutes [webmasterworld.com]