Results 1 to 10 of 10
  1. #1
    Full Member
    Join Date
    January 18th, 2005
    Posts
    224
    Help with SSI layout?
    I've been looking all over for a comprehensive tutorial on how to set up SSI includes on a website.
    I want to build a 3 column template with the left menu, top header, right menu, and bottom footer areas using SSI so I can change the page structure once, affecting globally.

    Does anyone know of a resource online (free) that can teach me how to do this? Or is there an example that I can view and try to reverse-engineer?

    I've been searching google, and can't seem to find exactly how this works and how to set it up. Most of the SSI pages I can find are WAY over my head, they might as well be written in japanese or something. Can you "dumb it down" for me?

    Thanks,
    Rick K.

  2. #2
    Roll Tide mobilebadboy's Avatar
    Join Date
    January 18th, 2005
    Location
    Mobile, Alabama
    Posts
    1,220
    For SSI, you're key tag is:

    Code:
    <!--#include virtual="/path/to/file" -->
    To keep it simple, your pages should end with a .shtml extension. Your included files can be whatever you want them to be, even .txt files. The .shtml extensions let the server know that SSI includes are being used on that page. It's been years since I've used SSI (PHP now), so if that necessity has changed, I hope someone will correct me. You could add directives to an .htaccess file, but I won't go there.

    Now you simply take any code you want to include globally, and add it to it's own file. I'll give you an example of a single table broken down into sections. Of course you may not want to use a single table, but hopefully I can give off the basic idea.

    I'll assume you understand basic HTML.

    Code:
    <table>
    <tr>
    <td colspan="3"> This is your header </td>
    </tr><tr>
    <td> This is your left column </td>
    <td> This is your center column </td>
    <td> This is your right column </td>
    </tr><tr>
    <td colspan="3"> This is your footer </td>
    </tr>
    </table>
    Now you want to separate that into into individual files. Ok.

    header.html
    This is your header

    left.html
    This is your left column

    right.html
    This is your right column

    footer.html
    This is your footer

    Now you have 4 files with your surrounding elements in them. Now to include them into any page you wish (Assuming files are all in the same folder/directory).

    Code:
    <table>
    <tr>
    <td colspan="3"> <!--#include virtual="header.html" --> </td>
    </tr><tr>
    <td> <!--#include virtual="left.html" --> </td>
    <td> This is your center column </td>
    <td> <!--#include virtual="right.html" --> </td>
    </tr><tr>
    <td colspan="3"> <!--#include virtual="footer.html" --> </td>
    </tr>
    </table>
    That's really all there is to it. Or maybe it is to me since I'm explaining it.

    Not to confuse you, but you can do the same exact thig with PHP. But the include code would be:

    Code:
    <? include('header.html'); ?>
    Speak up if (and where) I lost you. We'll go from there.

    Shawn Kerr (.com) | Disney World | SEC Football

  3. #3
    All Around Web Guy Cursal's Avatar
    Join Date
    January 18th, 2005
    Posts
    829
    MobileBadBoy pretty much summed it up, but This gives a little visuals with the tut. And no you don't need DW to do it, the tut is where I got the hang of it and I don't think I could live without them anymore ...LOL

    GO HERE

    Good Luck
    --Brian
    Oregon Publishing: Web Development, Graphic Design, Domains & Marketing
    Deluxe Banners Bartender's Guide Cooking Jobs

  4. #4
    All Around Web Guy Cursal's Avatar
    Join Date
    January 18th, 2005
    Posts
    829
    Also when you get the hang of it you may wnat to hide your .shtml in the addy bar or if your site is html and you want to use SSI you can do it via the .htaccess file.

    I know that may be a bit advanced at this stage for you, but bookmark it for later.

    Here is this one
    Oregon Publishing: Web Development, Graphic Design, Domains & Marketing
    Deluxe Banners Bartender's Guide Cooking Jobs

  5. #5
    ABW Veteran Mr. Sal's Avatar
    Join Date
    January 18th, 2005
    Posts
    6,795
    Check out The SSI Tutorials & Reference Pages from: http://www.bignosebird.com/ssi.shtml

    They got some good info on SSI and more free stuff to help webmasters with related scripts.

    Sal.

  6. #6
    Full Member
    Join Date
    January 18th, 2005
    Posts
    224
    Thanks!
    Shawn, thanks for the simplified "dumbed-down" explaination. That helped me follow the tutorials pages that Brian pointed me to.

    I know Mr. Sal believes in SSI, he pointed me in that general direction with a hint or two a couple of weeks back.

    Now here's a million-dollar question - Now that I grasp the basics of SSI, should I continue to learn SSI, or is PHP more powerful and easier? Shawn said:

    It's been years since I've used SSI (PHP now), so if that necessity has changed
    I see that a lot of webmasters are turning to PHP. What are the advantages of PHP vs. SSI? I see templates, a datafeed application I'm trying to learn, and lots of programs written for PHP.

    Given that there's a learning curve involved with both languages, which would be the easiest and best to learn? I know HTML, some basic javascript, but know zilch about writing programs. I've always used someone else's cut-and-paste code to accomplish what I want.

    But, I'm currently working on my main biggie website, and need custom functions that I can't find, and need to learn to create on my own.

    SO, In your opinions, which way should I go? SSI or PHP?

    By the way, thanks for taking the time to reply and give examples. ABestWeb is the greatest!

    Rick K.

  7. #7
    Full Member
    Join Date
    January 18th, 2005
    Posts
    224
    One more thing:
    AT the tutorial site that Brian pointed me to, it seems pretty basic, at least I'm getting the gist of it, except for one statement,

    1. Create a new ASP VBscript file by clicking File > New and choose Dynamic Page, ASP VBScript. Save the file as content.asp so our include paths will be correct once we've added them in.
    Whoa. Shawn says to make seperate files ending in the .html extension, and call them using the
    <!--#include virtual="/path/to/file" --> command.
    This is confusing me. The tutorial says to create a active server pages visual basic script file and save it with the .asp extension. Is this a Dreamweaver function, or am I missing something here?
    Thanks,
    Rick K.

  8. #8
    Resident Genius and Staunch Capitalist Leader's Avatar
    Join Date
    January 18th, 2005
    Location
    Florida
    Posts
    12,817
    visual basic script
    That's a scripting language...

    I don't know much about .asp, but what I can tell you is that .asp pages are different from the SSI you've been talking about... Maybe the SSI part is in a different section~?
    There is no knowledge that is not power. ~Hemingway

  9. #9
    All Around Web Guy Cursal's Avatar
    Join Date
    January 18th, 2005
    Posts
    829
    Rick,
    When calling a SSI you can use .asp or .html (and other extensions) & it will work fine, but use the code
    <!--#include virtual="/path/to/file" --> to invoke the include.

    The tut was to help you get the gist of it not to do exactly as it says.
    ----

    Also in php you can call includes too, using

    <?php require("yourpage.html"); ?>
    or
    <?php require("yourpage.php"); ?>

    When using files within directories be sure tio use an absolute path starting from the server or you will get errors. (when using php)
    ----

    As for coding... it is a personal choice and for each person to decide what works best for them. Of Course if you know other languages use code that works best for the job.

    I'm no php wiz (still learning) but have seen the power of it and you can mix it up with html and still use includes. Very cool.

    Hope that helps Rick.

    I have had lots of help here at ABW and am happy to help if I can. This place rocks

    Brian
    Oregon Publishing: Web Development, Graphic Design, Domains & Marketing
    Deluxe Banners Bartender's Guide Cooking Jobs

  10. #10
    Full Member
    Join Date
    January 18th, 2005
    Posts
    224
    Thanks, Everyone
    Especially to Brian.

  11. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Need help With SSI
    By Doug247 in forum Programming / Datafeeds / Tools
    Replies: 1
    Last Post: December 8th, 2003, 08:35 PM
  2. ssi?
    By buyyourstuff in forum Cusimano.com Scripts
    Replies: 1
    Last Post: April 4th, 2003, 11:49 PM

Posting Permissions

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