My First SSI - Worked! But Did I Do It Right?

Roo's picture

She has: 840 posts

Joined: Apr 1999

I just did my first include and it worked. I'm just wondering if I did it right?

I just renamed an html file index.inc and uploaded it
Then called it into an .shtml page like this:

Is this right? Does there have to be an .inc file?

Roo

She has: 120 posts

Joined: Oct 2000

Roo, I have used ssi on many of my sites.
I name the file to be included with a .shtml
(yes just like the one calling it)
I haven't as yet had any problems with that.
I generally don't call a whole page into another though,
just parts of one.

~bobbi

"Nothing worth having comes without some kind of fight- 'Got to kick at the darkness 'til it bleeds daylight." - Bruce Cockburn

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

.inc or .txt or .html or .shtml -- it only needs to be .shtml if the included file contains further scripting.

If it works, hon, it's right. If it's not right, it won't work, period. Wink

Roo's picture

She has: 840 posts

Joined: Apr 1999

Whew! I've read so many things and some say .inc, and others say you can call other files. I've got the big fat black book in front of me now....it was sitting here staring at me, but I wasn't seeing it. Smiling

I was using a whole page for my custom error pages. Using the same one for everything until I actually get the site done.

Roo

He has: 1,758 posts

Joined: Jul 2002

Just a tip for you. If you have a page that has for instance a menu include and includes for headers and footers, precede the names with an "_" this will ensure they always show at the top of alphabeticlly file lists and stand out from your normal pages. ie:

_header.shtml
_footer.shtml
_menu.shtml

Smiling

Andy

He has: 152 posts

Joined: Jun 2004

HOw do you call the menu , footer , header on to a page plz Laughing out loud

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

As Bobbi said, as well -- make sure that your includes are not whole pages like with frames, but rather pieces only, like a single div that contains all the content or the navigation, et cetera.

Roo's picture

She has: 840 posts

Joined: Apr 1999

Yeah I'm going to try using it to assemble a page with, so the tips are good! This first one was for my custom error pages. I wanted something, but until I settle on a new deisgn I'm using the same file for all of them.

Saurons:
I think...(and mind you I'm new with includes) that you'd just put

Or

In the area where you want to include these things. I'll be playing with this tomorrow....my freinds son is graduating in a few hours!

Roo

He has: 19 posts

Joined: Jun 2004

If you really need to include many files, it may be worth while to learn a little PHP.

With SSI you have:

<html>
<head></head>
<body>
<!--#include virtual="FILE.ext"-->
</body>
</html>

With PHP you have:

<?php
include('file.ext');
?>

If you need any PHP programming don't hesitate to shoot me an email or PM me here at Webmaster-Forums!

[EMAIL] [PM]

She has: 120 posts

Joined: Oct 2000

http://bignosebird.com/ssi.shtml

I break my sites down into sections of code:
meta.shtml
header.shtml
navtop.shtml
ect.

You can break it up any way you want.

I had 2 different places bookmarked that had great easy to understand tuts on SSI's, but they are both gone now.
I think I have the web pages archived somewhere and will try to dig them.

I am assuming php works about the same way,
I haven't tried that route yet, but may experiment a bit this summer.

~bobbi

"Nothing worth having comes without some kind of fight- 'Got to kick at the darkness 'til it bleeds daylight." - Bruce Cockburn

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.