A place to explore templating functionality in ZWiki, following up this thread. See also: UsingMultipleTemplatesQuestion

What do we mean by the T word

Here's a suggested glossary to help us discuss template-like things:

one of the following, depending on context :)
wiki templates
complete ready-made starter wikis. These are installed in ZWiki/wikis/ (fs) or Control_Panel/Products/ZWiki/ (zodb)
page templates
Zope Page Templates (same usage as in the rest of the zope world)
skin templates
used generically in Zwiki development for skin-related objects - usually page templates or dtml methods, also the dtml document or File used for stylesheet, etc.
content templates

standard blocks of text (including markup) to be re-used in wiki pages. The template text could be either

  • included as-is
  • customized with parameters

Also it may be included/evaluated either

  • at creation of the including page - eg moinmoin's template pages
  • at each edit of the including page - eg mediawiki's {{subst ...}} macros
  • at each view of the including page - eg mediawiki's {{...}} macros
template pages
We could use wiki pages to define content templates, like moinmoin. We'll probably do this, so the terms "template pages" and "content templates" may be interchangeable for our discussions.

Content templates, template pages

An idea we didn't discuss for template pages - offer them based on the page hierarchy:

(07:00:41) wbell_: Q: Thinking about building hierarchical wiki for a charitable organisation. When user adds a page to the one called "clients" it would not be blank; rather it would be a form to be completed and the fields from the form would be deposited in the linked page. Anyone have any suggestions?
(07:08:56) sm-afk: hi wbell
(07:09:21) sm-afk: we last discussed that feature around http://zwiki.org/UserDiscussion200509#msgdh1oq0$4o1$1@sea.gmane.org ("moin-style template pages")
(07:09:41) sm-afk: we didn't consider having it depend on the hierarchy
(07:10:08) sm-afk: how/where would you specify the content for new pages ?
(07:10:52) sm-afk: wbell_, I should say
(07:12:50) sm-afk: random idea: you could create a child page named SomethingTemplate
(07:13:26) sm-afk: then modify renderLink to add a ?text= argument to the ? links
(07:14:18) sm-afk: using the content of the parent page's child named *Template

(07:42:30) sm-afk: more hints:
(07:42:30) sm-afk: def templatePage(self):
(07:42:30) sm-afk:   templates = [p for p in self.childrenAsList() if p.endsWith('Template')]
(07:42:30) sm-afk:   return templates and self.pageWithName(templates[0]) or None
(07:42:30) sm-afk: it moved.. ZWikiPage.py line 650.. "...&text=%s..." % self.templatePage().text()

Bill Bell is exploring this. (Who is this Bill Bell and where can we find him for questioning ?)

2006/08 chat:

(02:40:55 PM) DaSkreech:  So You can technically have a template called on the hierarchy ?
(02:54:49 PM) sm: DaSkreech: sure, we could implement that
(02:55:29 PM) sm: eg walk up the hierarchy until you find a sibling page named ...Template ? something like that
(02:57:02 PM) sm: or, from all existing ...Template pages choose the first one corresponding to a parent as you walk up the hierarchy
(02:58:05 PM) sm: sounds too complicated for most uses
(02:59:45 PM) sm: but, eg what I meant: say I add a page below ContentTemplates, if a DeveloperNotesTemplate exists, that would be used to fill in the new page
(03:00:17 PM) sm: anything created under DeveloperNotes would use DeveloperNotesTemplate
(03:00:23 PM) sm: doesn't sound too bad
(03:00:40 PM) sm: except it takes a chunk of the wiki name space
(03:01:02 PM) sm: can't name your regular pages ...Template
(03:01:12 PM) DaSkreech: Well you can name them Templates
(03:01:29 PM) DaSkreech: Which actually makes more sense if you are talking about Templates
(03:02:38 PM) DaSkreech: Was there ever a discussion on the macros?
(03:03:19 PM) sm: which macros
(03:21:24 PM) DaSkreech: On the same page it mentions the use of moinmoin type macros or mediawiki type macros
(03:22:54 PM) ***sm thinks
(03:23:40 PM) sm: well we have no special support for any of these right now
(03:24:05 PM) sm: but dtml can mimic the last (view-time macros) pretty easily
(03:24:33 PM) sm: <dtml-var "include('TemplatePage')">
(03:25:36 PM) sm: dtml is our macro language
(03:25:59 PM) sm: edit-time macros could be implemented in the editform template
(03:26:12 PM) sm: we need something less powerful than dtml though
(03:26:55 PM) ***DaSkreech grins
(03:27:49 PM) DaSkreech: So there hasn't been a discussion on this less powerful replacement?
(03:28:38 PM) sm: we've touched on it over the years, I don't know of a page with substantial discussion
(03:28:44 PM) DaSkreech: ok
(03:28:53 PM) sm: I guess it's a matter of choosing who's syntax to copy and implementing it
(03:29:40 PM) sm: it's definitely something useful to reach a wider user base
(03:29:54 PM) DaSkreech: not given much thought to it?
(03:31:02 PM) sm: I've thought about it repeatedly.. and this page and discussion is where I've got to
(03:31:20 PM) DaSkreech: :-D
(03:31:23 PM) sm: this is the furthest yet!