Pass parameters to an INCLUDE
- Tip Category - Developing Wiki Applications
- Tip Added By - RichMorin - 29 Sep 2009 - 18:55
- Extensions Used - None?
- Useful To - Beginners
- Tip Status - New
- Related Topics -
Problem
You want something like a macro or a user-defined parameterized variable.
Context
You want to write some TML which acts differently, based on how you use it.
Solution
TML INCLUDEs work quite nicely as macros.
Basically, any named include argument (eg,
foo="123")
that doesn't match a predefined parameter
can be used (eg,
...%foo%...) in the body of the include.
Here is some setup code:
%STARTSECTION{"bl_amz"}%
* [[http://www.amazon.com/dp/%isbn%/?tag=assorted0a-20][%title%]];
%author%; %imprint%
%IF{ "defined notes" then="<p>%notes%" }%
%ENDSECTION{"bl_amz"}%
Here is the usage code:
%INCLUDE{"Projects/WebIncludes" section="bl_amz" imprint="Developer's Library" isbn="067232685X"
author="Chris Newman"
title="SQLite"}%
Known Uses
Known Limitations
See Also