Forum Moderators: mack

Message Too Old, No Replies

Using PHP/SSI

repeated content

         

mlava

1:59 am on Sep 17, 2005 (gmt 0)

10+ Year Member



Hello

I have searched this site for info on using PHP includes or SSI for repeated content, and found many threads

Can't quite get to the bottom of it, so here are my questions...

I have a site, around 400 pages (plus a small message board but that isn't included in this discussion), and am adding about 1 page per day

Obviously, I need to use some form of includes to make site-wide changes more easily - have previously been using NoteTab Light to search and replace them all at once, but this is clearly the wrong way to go about it.

All of my pages are .html and I am loathe to change them .shtml or .php

The way I see it, the options are:

1. use SSI and change the .htaccess file to parse all .html files for SSI

2. use PHP include and change the .htaccess file to parse all .html files for PHP

3. use SSI and the x-bit thingy

4. iframes - clearly the wrong option for search engines

5. continue batch editing in notetab

Can anyone advise?

I am concerned about the download/display hit by making all .html files get parsed for either SSI or PHP, but don't know if this is really a major issue or not? I am on a shared server, so don't know if i can do the x-bit thing.

Also, if I change the .htaccess in my root directory, do i need to add one to each subdirectory (of which there are hundreds!) or does it flow down?

sonjay

12:22 pm on Sep 17, 2005 (gmt 0)

10+ Year Member



I like option 2 (use php includes and parse .html files for php). If you're using includes on every html page, then you're not parsing anything unnecessarily. The server hit is minimal -- IMO, if it's noticeable, you need a server upgrade.

Using php includes rather than SSI includes easily allows you to incorporate other php scripting into your site down the road, should you need to. SSI is much more limited.

mlava

1:18 pm on Sep 17, 2005 (gmt 0)

10+ Year Member



I have seen that said on a few of the similar threads here... what other things do you mean?

do you mean that if i wanted to run a database=based site, by having php includes rather than SSI would make it easier to convert?

thanks for replying :)

sonjay

1:50 pm on Sep 17, 2005 (gmt 0)

10+ Year Member



Yes, it would definitely make it easier to use a database on your site. In general, it would make it easier to start using any of the gazillion-and-one things you can do with php: process a contact form, let people sign up for your newsletter, use conditional logic to display certain things on your page if a particular condition is met. For example, if it's Friday, display a TGIF graphic above your navigation, with a link to your favorite watering hole. That's a silly example, but you can use so many types of conditional logic to do so many different things. Other examples: If the page is in a certain directory, use a different color for the headlines. If the user-agent is IE, display a Firefox link.

I've been doing a lot of sites lately that have either user logins, or admin logins, or both. I use conditional logic in my nav: If the user is not logged in, display the log in link. If the user is logged in, display the log out link. If the Admin is logged in, display a link to the main admin page. And so forth.

Basically, parsing all your .html files for SSI allows you to do a very limited number of things. Parsing for php allows you to do nearly anything. The server hit is the same either way. So why use SSI includes when php includes are just as easy and allow for so much greater flexibility down the road?

mlava

11:24 pm on Sep 17, 2005 (gmt 0)

10+ Year Member



thanks again sonjay, that's much clearer

am going to try today - test out some footers on my pages and see how easy it makes it ;-)

thanks again

jatar_k

3:36 pm on Sep 20, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could also try this thread, might give you some ideas for php
A dynamic site in 2 minutes using PHP [webmasterworld.com]