SSI Helper

This page allows you to quickly produce server-side include tags, so you can just copy'n'paste them into your .shtml. Please see Tech Note 111 for further stylistic and practical guidelines.

Page skeleton generator
This helps you generate a skeleton .shtml page, and lets you choose values for all of the shtml parameters. We have added our recommendations to the comments on the right of the entry boxes.
People link generator
This helps you generate shtml includes to link to staff pages. This saves you a bit of typing, and means you don't need to maintain email addresses, phone extensions, or titles / degrees.
Also, you can insert links for roles within the School (such as Programme Directors, Head of School, Disability Co-ordinator) - this saves you from updating your webpage when this information changes.
Course link generator
This helps you generate shtml includes to link to course information pages. This saves you from remembering the canonical location of course info, and means that changes in the course title, directory structure etc. will not require your page to be updated.
Miscellaneous SSI
A list of other server-side includes that we commonly use on the MCS website. Sub-headings, horizontal rules, $course_home variables, checking for a logged in user...

These generators require a reasonably recent web browser, running javascript. Opera, Mozilla and Konqueror should be usable choices on our NetBSD systems.


Page template

Page title:
Authors name: (This is turned into an email address, so use periods to seperate your name. e.g. "Kirk.Jackson")
Under Construction? (If you still have work to do)
Sidebar visible? (recommended)
Standard sidebar visible? (recommended)
Generate an example sidebar? (Inserts example code for you to create your own sidebar)

Copy and paste the following code into your .shtml file:

People link generator

People in the School each have their own 'official' homepage under the /people part of the website. Rather than constructing links by hand, or inserting staff member email addresses into your web pages, we'd prefer if you used one of these server-side includes (plus, it'll make your life easier!)

Also, there are several 'roles' within the School, and you'll sometime want to include a link to the Programme Director, Computer Science, or Head of School, without having to keep the names of the people up-to-date.

Choose a person, click "Generate", and copy the resulting text into your web page

If you want to include the full title of all people on a page (e.g. 'Dr' or 'Prof'), then include the following code near the top of your page:

Course link generator

Courses taught in the School each have their own 'official' homepage under the /courses part of the website. Rather than constructing links by hand we'd prefer if you used one of these server-side includes. It will produce a hyperlink like this: COMP 204

Choose a course, click "Generate", and copy the resulting text into your web page

Miscellaneous SSI

Forum SSI - Announcements

For information on adding a sever side include to show current announcements from the forum - see TechNote 115 Using the MSCS Forum System

Sub-headings

MCS headings (like "Miscellaneous SSI" above) should be used instead of <h2> tags in your HTML.

It is possible to make the text in the heading link to another web page by setting an extra variable called subheadingur.

To insert a sub-heading into your .shtml, copy and paste the following text:

Horizontal rules

On the MCS site we use our own horizontal rules instead of the standard <hr> tag. There is a long horizontal rule (recommended), and a short one.




To insert one of them into your text, copy one of the following lines:

The $course_home variable

Course coordinators often find themselves maintaining a large website, with files in lots of sub-directories. A common solution to the repetition of keeping a lot of files up-to-date is a customised variables.shtml or head.shtml which is put into the home directory of the course (see the example course EXPL000 mentioned in Tech Note 111 for details).

So then the author needs to encode the location of their variables.shtml file in each page:

<!--#include virtual="/courses/EXPL000/2003T1/variables" -->

...which is not ideal, especially if you're going to copy these pages and use them next year.

Enter the $course_home variable. The webserver sets an environment variable for each course, that is accessible through Server-Side Includes. This lets you use the variable in your sidebar or include definitions:

You will notice that when using the variable inside another SSI directive, you put a $ in front of it - and when you want it to appear in your HTML, you have to put it inside an #echo tag.

The $year variable

Time dependant information on our website should have a disclaimer stating the year for which it is valid. Our site templates will automatically insert a disclaimer at the top-left of the page if you set a $year variable in your code:

<!--#set var="year" value="2004" -->

For course homepages, we automatically set the $year variable for you, as we can determine the year based upon the url to your page.

Checking for a logged in user

Sometimes you'll want to customise a page based on whether the visitor has logged in to the MCS website.

For example, the 'login' link at the top of the page turns into 'logout' after the visitor logs in, and the 'Staff' link on the sidebar only appears for MCS Staff.

Our Authentication and Authorisation module (see Tech Note 111) sets a few environment variables which can be useful:

  • REMOTE_USER: the standard CGI variable, containing the' Unix usercode for the logged-in user.
  • MCS_USER: the user@realm combination used to log in to the website (e.g. jacksoki@STAFF.VUW.AC.NZ).
  • MCS_PRINCIPAL: the username from MCS_USER (e.g. jacksoki).
  • MCS_REALM: the realm part from MCS_USER.
  • MCS_GROUPS: a colon-seperated list of all the Unix groups that the logged-in user belongs to. For example:
    :staff:wheel:cs-staff:grads:comp100:comp200:comp300:
  • MCS_LOGIN_URL / MCS_LOGOUT_URL: Url's that you can send a user to, so that they can login or logout.

Here's an example piece of an .shtml that gives a vistor a login link if they haven't logged in, and then customises the information displayed based upon whether they're in the staff group or not:

Note that this doesn't provide file system security, so you should use these variables for customisation of pages, rather than security.