Property Substitutions

ProWiki | RecentChanges | Preferences

Showing revision 9
Previous: Defining Properties

The real power of properties comes in the ability to stick queries into pages. That is, pages don't have to be entirely static text: they can also have generated text, based on the properties on this page or others. There are two major types of queries. This page will cover Property Substitutions, and the next will cover Page Queries.

Property Substitutions

Property substitutions are queries that basically say, "insert the values of the specified properties in this text". They currently come in three major flavors: variable substitution, property lists and property checks.

Variable Substitution

Variable substitution is the simplest of all queries, and underlies all of them. It just says, "stick the value of a named property here". The syntax looks like this:

%%propname%%

So say that we have the following property definition:

ExamplePageAbstract = Describes the basic ways to put properties in pages.

Then this variable substitution:

%%ExamplePageAbstract?%%

would render like this:

Describes the basic ways to put properties in pages.

This may seem like a minor feature -- after all, the value is right there on the page! But it will become far more useful when combined with more sophisticated queries, and with display templates.

PAGENAME

Each page has an implicit property called PAGENAME, which gives the actual name of the page. You don't define this explicitly -- it's always there. You can access it like any other property:

%%PAGENAME%%

Rendering that on this page produces:

Property Substitutions

Note that PAGENAME references are always displayed as links -- if you click on the reference, it will take you to the specified page.

Property Lists

The first serious type of query is the property list. Its syntax looks like this:

{propname : pattern}

Roughly speaking, this means "for each propname property on this page, substitute in the given pattern".

For example, let's give this page several ExampleItem properties:

ExampleItem = A big black book

ExampleItem = Deck of cards

ExampleItem = Some pocket lint

We can now add a query that goes through all of these properties and lists them:

{* ExampleItem : <b>A big black book | Deck of cards | Some pocket lint</b><br> *}

When displayed, it looks like this:

A big black book
Deck of cards
Some pocket lint


ProWiki | RecentChanges | Preferences
This page is read-only | View other revisions | View source of this page | View current revision
Edited September 28, 2004 5:38 pm by h0008023f8530.ne.client2.attbi.com
Search:
Edit: