Monkey Wiki templates are HTML files which can contain anything at all that any other web page might contain. Of course that means you can Use Cascading Style Sheets, for which Monkey Wiki provides certain classes and IDs in its output. So, just fire up your favourite HTML editor and create some pages as you want them to look for the various scenarios described in What Templates Can Be Defined. They should be saved without an extension, and placed in the template directory specified in the configuration section of the script.

Obviously you don't want to write the actual text of each page, because you are trying to run a dynamic-content site! So, where the actual text from the wiki is to go, you place tokens, which take the general form

<!--#token-->

These tokens can be any valid Python expression, including any variables available within the namespace of the method that renders the page. However you don't need to worry too much about that, because most commonly this will simply be a variable named 'wiki'. This includes a header, contents and footer (just like the page you are reading now)

Thus:

If you don't want to postion the elements of the page in this predefined way, or perhaps want to omit the header or footer, you can place them separately by referring to them instead as 'self.header', 'self.contents' and 'self.footer'.

You can also get at various other attributes of the page, including its name, title, filename etc. These are referenced in the following way: 'self.page', 'self.title', 'self.textfile'
Thus:

You will probably want to put either self.page or self.title inside <title></title> tags in the template (up in the HTML <head></head> section).

Here is an example of how you might want to use self.textfile - this shows when the file was last modified:

<!--#time.ctime(path.getmtime(self.textfile))-->

(If you don't know Python, just copy this exactly!)

To include the content (contents only) of another page within the wiki (called 'OtherPage' in the following example), use the following form:

<!--#WikiPage('OtherPage')-->

Environment variables can be included using the following form:

<!--#os.environ["SCRIPT_NAME"]--> (using SCRIPT_NAME as an example here)

Advanced users can examine the code to see what other expressions might be possible, but obviously care is required, for example to avoid infinitely recursive inclusions.

Any token which is not successfully evaluated is ignored.

Last modified: Thu May 31 22:22:33 2007

Valid XHTML 1.0 Strict Valid CSS! [Python Powered] hosting by gradwell dot com Ltd
Wiki Spam controlled by LinkSleeve