[Moin-user] Templates with attributes

Tim Bird tim.bird at am.sony.com
Thu May 10 17:53:51 EDT 2007


Harri Paavola (Intern) wrote:
> Hi,
> 
> I'm a total newbie when it comes to MoinMoin, but I've used and maintained
> MediaWiki sites quite much.
> 
> I'm now trying to create templates that would use attributes and the Help on
> Templates page ( http://moinmoin.wikiwikiweb.de/HelpOnTemplates ) isn't too
> helpful. Is that possible at all, if it is, how?
> 
> What I'm trying to do, is to create a certain template that would contain a
> table. I'd like to change some of the content of that table by just giving
> some attributes when I'm calling the template.

I'm not sure I'm following your request.  A template in MoinMoin is really
just a page that ends with the word "Template".  All it does is
provide starting content (instead of a blank page), when you do
a page creation (and the user selects it from the list of templates
on the page creation dialog.  You don't really "call" a template.
It is only copied once, when the page is created.

Attributes, in wiki terminology, are those things you put in a table to
control formatting.  I'm not sure if you want to change these on page
creation?

A variable is something that will expand into another bit of text when
a page is saved.  See http://moinmoin.wikiwikiweb.de/HelpOnVariables
You can put variables on a template, and they will expand when the
template is saved (the first time) as a page.

You can create your own variables, so that a user (maybe only yourself,
I haven't played with variables very much) could choose from a bunch
of different variables when they are presented with the first edit
of the page.  This would allow them to insert lots of longer phrases
or items onto the page, without having to type everything.

E.g. '@red@' could expand to '<row_bgcolor=red>', if you wanted to make
it easier to have people set the table attributes on page creation.

I think.  As I say, I haven't played with variables myself.
 -- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================





More information about the Moin-user mailing list