• Edit
  • View
  • Diffs
  • Info
  • Subscribe
  • Raw
  • Print
Differences between revisions 2 and 4 (spanning 2 versions)
Revision 2 as of 2006-05-14 12:16:12
Size: 72
Editor: dhcp0404
Comment:
Revision 4 as of 2006-05-14 21:56:06
Size: 2151
Editor: dhcp0404
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#acl All: == widget: a CMS-like theme ==
Line 3: Line 3:
This page, and subpages, is used by the default theme of this site. It allows the theme of this wiki to include elements from the wiki itself, which in turn allows each page to have its own menu, say, or its own sidebar.

In the theme definition, there is a function called `extraObject(d, location)`. For this page, location is `sidemenu`. In the middle of the python script defining the theme (take a look at file [attachment:Notes/widget.tar.gz `widget.py`]) is a call to the function `extraObject(d, sidemenu)`. This causes the script to look on the wiki page `/site/sidemnu` for an ordered dictionary like the one found below. Each dictionary key on this page is a regular expression which is matched against the page the theme is currently putting together, and the value is either an attachment or a subpage of this one (see below for more on this). So if a visitor asks for page !SomeOtherWikiPage, the theme knows that the "extraObject" it needs to pull into the theme is called !MenuPageNotYetCreated, and that file is inserted into the page.

 SomeOtherWikiPage:: MenuPageNotYetCreated
Line 5: Line 10:
The function `extraObject` then looks in one of three places for the object, in the following order:
 1. It looks for any preformatted text on page /site/sidemenu/!MenuPageNotYetCreated and inserts only the preformatted bit into the page at that point.
 1. If there is no preformatted text, it uses the page /site/sidemenu/!MenuPageNotYetCreated as it is rendered by !MoinMoin.
 1. If there is no page called /site/sidemenu/!MenuPageNotYetCreated, it looks for an attachment called !MenuPageNotYetCreated attached to page /site/sidemenu.
It then inserts that HTML directly into the theme at the point where `extraObject` is called.

So on this page the rules above say that for all pages except !SomeOtherWikiPage, use the subpage ["/default"] as a menu.

This allows you to have, for example, a donate button on some pages of your site, or perhaps it allows you to have context-dependent menus.

=== Subpages: ===
Line 6: Line 22:

=== Attachments: ===

widget: a CMS-like theme

This page, and subpages, is used by the default theme of this site. It allows the theme of this wiki to include elements from the wiki itself, which in turn allows each page to have its own menu, say, or its own sidebar.

In the theme definition, there is a function called extraObject(d, location). For this page, location is sidemenu. In the middle of the python script defining the theme (take a look at file [attachment:Notes/widget.tar.gz widget.py]) is a call to the function extraObject(d, sidemenu). This causes the script to look on the wiki page /site/sidemnu for an ordered dictionary like the one found below. Each dictionary key on this page is a regular expression which is matched against the page the theme is currently putting together, and the value is either an attachment or a subpage of this one (see below for more on this). So if a visitor asks for page SomeOtherWikiPage, the theme knows that the "extraObject" it needs to pull into the theme is called MenuPageNotYetCreated, and that file is inserted into the page.

SomeOtherWikiPage

MenuPageNotYetCreated

.*
default

The function extraObject then looks in one of three places for the object, in the following order:

  1. It looks for any preformatted text on page /site/sidemenu/!MenuPageNotYetCreated and inserts only the preformatted bit into the page at that point.

  2. If there is no preformatted text, it uses the page /site/sidemenu/!MenuPageNotYetCreated as it is rendered by MoinMoin.

  3. If there is no page called /site/sidemenu/!MenuPageNotYetCreated, it looks for an attachment called MenuPageNotYetCreated attached to page /site/sidemenu.

It then inserts that HTML directly into the theme at the point where extraObject is called.

So on this page the rules above say that for all pages except SomeOtherWikiPage, use the subpage ["/default"] as a menu.

This allows you to have, for example, a donate button on some pages of your site, or perhaps it allows you to have context-dependent menus.

Subpages:

Navigation(children)

Attachments:

AttachList

site/sidemenu (last edited 2022-10-10 09:40:17 by PaulHowarth)