bild
School of
Computer Science
and Communication
KTH / CSC / CVAP / Kai Hübner / Other / Making your own CSC website

Note: This page is an inofficial translation of the official, Swedish instructions for making an official CSC web page, so blame me for translational errors. Also, the linked documents are still in Swedish, but at least this tutorial should give you an outline on how to put up you own webpage with CSCs template.

Template for official CSC-websites

On this page, you can find information about how the templates in the kurswebb/1.1 package can be applied for making an official webpage for KTH CSC.

Course websites

A brief description of how to make course websites can be found at the pages of the internal teacher information (in Swedish).

Outline

The set goal is that it should be easy to write an official website, and that source code from old pages can easily be copied and pasted into an official website. The package can be used either together with a text editing program, like emacs, for those that prefer writing HTML code, or together with a graphical tool like Dreamweaver as long as the tool can handle PHP pages.

An official website consists of, besides the source code, of a page header, a page footer, and in many cases even of a menu bar. At the top of each page, above the page's heading, there is a search path that shows where the actual page is placed on CSCs webplace. For this page, the search path is KTH / CSC / Internt / Webbsidor.

The source code is written using common HTML-code (HTML 4.01 strict). What kurswebb offers is a comparably simple and automatic handling of the additional parts: header, footer, menu and search path.

A minimal site

This is a minimal site without menu. Its source code is

<?php
  include('/public/www-csc/include/kurswebb/1.1/school-defs.php');
  setTitle('A minimal site');
  makeHeader();
?>

<h1>A minimal site</h1>
This page is without both menu and search path.

Besides the HTML code there is a PHP-block (between <?php and ?>) which first includes the definitions corresponding to the kurswebb/1.1 package, thereafter defines the title (the text that appears as title of the window and as text if one saves the page as a bookmark or favorite) and finally, calls makeHeader() which generates the page header. The page footer is generated automatically.

Menus

To generate a menu, a menu file (an XML file that describes the menu) and a command that tells the page to apply this menu file are needed. This page uses a menu file, and the PHP block in the beginning of that file looks like this:

<?php
  include('/public/www-csc/include/kurswebb/1.1/school-defs.php');
  setCss('webb.css');
  setTitle('[KTH CSC] Om kurswebb/1.1');
  pathHeader('navigation.xml');
?>

The important difference in comparison to the menuless page is that makeHeader() has been replaced by pathHeader('navigation.xml') where the argument is the file path to the menu file.

The command setCss() has nothing to do with the menu. You can read more about this commando on the page about modifications.

To be able to use a menu, you need to describe the menu with an XML file. Read more about this on the page about menu files.

A web place

Often, a number of websites correspond to a web place. For CSC pages, this includes that pages often share a menu, even if this menu can appear little different based on which page of the web place you currently are on. For example, submenus appear only sometimes, and selected menu alternatives are marked. This section describes how you can build a web place with a shared menu. There are three things to think about:

  1. Make an XML-file that decribes the menu. You can read about this on the page about menu files.
  2. Structure the web place with a main page, and additional pages in subdirectories. (This is not strictly necessary, but is what has been tested most and works best.)
  3. In each subdirectory you can place the page content in an index.php file.

Modifications

There are a number of modifications that one can, and often has to, do. Examples of what you can do:

  • Name the person responsible for the page (e.g. course teacher).
  • Chose English page (amongst others, this affects the page header and footer), or combine both English and Swedish versions of the page.
  • Name the character encoding (supposed to be ISO-8859-1, called latin-1, but if you use utf-8, e.g., instead, it is possible to state this).
  • Add copyright information.
  • ... and something more.

If you want to know more, read the page about modifications.

Published by: Kai Hübner <khubner@kth.se>
Updated 2008-10-10