|
You are here: Home / Documentation / XT Expressions |
XT ExpressionsThe real power behind the XT template language is not in the tags or in the XML at all, but in what's _inside_ the tags. That is, the XT Expression language, or XTE for short. This article is meant to serve more as an XTE language reference than as a tutorial, so you'll probably find it best to start off with one of the introductory articles first. XTE expressions are made up of three basic components and only two operators. These components are the string: path: and php: evaluation methods, which can be combined in a single expression to create more complex output, and the two operators are the semicolon and the pipe characters. A semicolon terminates an expression and begins a new one, but does so under the same output buffer, causing them to typically act like concatenators more so than separators. But semicolons are not necessary when going from one evaluation method to the next, making them rarely needed (and in fact, only supported by a few select tags, including <xt:if>, <xt:elseif>, <xt:exec>, and the xt:condition attribute). Pipes are used as an "or" command, which says "if the value of the first part of the expression results in no output or a false value (ie. a path that pointed to a nonexistant object), then try the next. Here is an example of the pipe operator: path: site/url | string: http://www.simian.ca/ This says to the XTE engine "use the value of the object path site/url, but if that's not found then use the string http://www.simian.ca/". There is one other syntax feature that can make it easier to concatenate paths into strings, which is the ${path} inclusion syntax. For example: string: one ${numbers/2} three ${numbers/4}
This is almost the equivalent of saying: string: one path: numbers/2 string: three path: numbers/4 The only difference is that the first is split into four separate expressions that are concatenated at the end, and the first is done as if the ${path} components were an inline sub-expression. The first is also shorter and makes it easier to distinguish its different components. Page 1: The real power behind the XT tem... |
|
Copyright © 2008, SIMIAN systems Inc. All rights reserved. Privacy policy Some of the icons on this site were created by the Gnome Project. |