View / Download this file.
-------------
TEMPLATE TAGS
-------------
----------
TAG FORMAT
----------
Where "Perl" represents your Perl code:
<?TEMPLATE Perl TEMPLATE?>
<?template Perl template?>
<?template Perl ?>
<?| Perl |?>
<?| Perl ?>
<?|
Perl
?>
-----------
DESCRIPTION
-----------
The TEMPLATE tag is used to import other PTM script files into your PTM
documents. The TEMPLATE tag's representing symbol is the pipe (|) character
as this most accurately represents its functionality. It is used to simply
load, or "pipe in", PTM script content from another file. All contents of
the templated file will be imported in place of the TEMPLATE tag and will
join in to be evaluated with the rest of your PTM script. The contents of
the TEMPLATE tag are evaluated to a file name before the file is loaded.
This ability allows you to load files dynamically by using variables instead
of having to use static file names. Because of this, however, the use of
single (') and double (") quotes is necessary when passing a file name, as
it will be evaluated as a Perl statement. Once evaluated to a file name, the
TEMPLATE tag contents are passed to the "get_file_text" function behind the
scenes. Therefore, no unquoted semicolons (;) should be placed inside a
TEMPLATE tag, as it would prematurely end the function call.
--------------
USAGE EXAMPLES
--------------
---------------------------------------------------------
Example 1: Loading a File by calling its Static File Name
---------------------------------------------------------
<?| "file.ptm" ?>
----------------------------------------------------------
Example 2: Loading a File from a Name Stored in a Variable
----------------------------------------------------------
<?| $file ?>
-------------------------------------------------------------------
Example 3: Loading ".ptm" Files 1-10 with the DO Tag and a For Loop
-------------------------------------------------------------------
<? for ($i = 1; $i <= 10; $i++) { ?>
<?| "$i.ptm" ?>
<? } ?>
|