This is some text. It will be ignored by the parser, and displayed exactly as it is.
{ 'This is a placeholder. It will be parsed, and appropriate action taken.' }
This is some more text.
Of course, placeholders should contain PTPScript code. In the example above, the text inside the placeholder is contained in a string, so it is valid code. Because nothing has been done to it, it will be displayed as it is. The same is true of [[PTPScript:Variables|Variables]] and [[PTPScript:Expressions|Expressions]], except for assignment, which produces no output. The text outside the placeholder can be anything - HTML, CSS, SQL, C++ - it doesn't matter, so long as it doesn't contain curly braces.
If the text does contain curly braces, the ''Show'' command should be used.
Here's another, more likely example:
This is a PTPScript example.
{ if 2 < 3 }
2 is less than 3.
{ else }
Something is wrong - 2 is not less than 3!
{ endif }
Well, that's the end of our example!
The code above should be easy enough to work out. The above example will output a fair amount of whitespace, so a way to reduce it might be:
This is a PTPScript example.
{ if 2 < 3
}2 is less than 3.
{
else
}Something is wrong - 2 is not less than 3!
{
endif
}
Well, that's the end of our example!
This will reduce the amount of whitespace displayed, because everything outside the placeholders is displayed as-is, whereas everything inside disappears as part of the placeholder expression (and may or may not result output - commands do not display any output).
However, the above example is not as easy to read as it could be. An alternate is to use the [[Whitespace#Whitespace Suppression Symbols|whitespace suppression symbols]] to suppress newlines and/or whitespace on either side of placeholders, as required. These symbols are ellipses (…) by default, but the backend programmer may choose to change them. The example code would now be written as:
This is a PTPScript example.
…{ if 2 < 3 }…
2 is less than 3.
…{ else }…
Something is wrong - 2 is not less than 3!
…{ endif }…
Well, that's the end of our example!
The above example would rely upon the ''GreedyLinebreakSuppression'' Directive being used, otherwise only one linebreak would be suppressed by each ellipsis. The default Directives are ''LinebreakSuppression'' and ''NoWhitespaceSuppression'', and examples elsewhere will be written accordingly.
{ Foo{SomeNumber}Bar }
In the example above, two [[PTPScript:Variables|Variables]] are shown. The second one is the one within the inner placeholders - ''SomeNumber''. The first is contained in the outer placeholder. Its name is formed from ''Foo'', plus the result of ''SomeNumber'' (inner placeholders are evaluated first, just like brackets), and then ''Bar''. So, if ''SomeNumber'' had a value of 15, the resulting variable name would be ''Foo15Bar''.
A more complicated example would be if ''SomeNumber'' contained the string "'' = 4 * ''". This would then make the outer placeholder into the expression ''Foo = 4 * Bar''. Although very useful in some situations, there is no way for the PTP engine to ever know what expression would result, and so it cannot be compiled.