View / Download this file.
---------
FILE TAGS
---------
----------
TAG FORMAT
----------
Where "Perl" represents your Perl code:
<?FILE Perl FILE?>
<?file Perl file?>
<?file Perl ?>
<?! Perl !?>
<?! Perl ?>
<?!
Perl
?>
-----------
DESCRIPTION
-----------
The FILE tag is used to import files into your PTM documents in standard
format. PTM tags will not be evaluated when the file is loaded, but if the
end user is viewing your calling PTM document with a web browser, any HTML
in the loaded file will be evaluated. This is most useful when you wish to
display PTM code to your audience, while keeping HTML formatting ability. It
is also useful in debugging while a site is in development, as you can view
the HTML formatted page while, at the same time, being able to see your
PTM/Perl code snippets. The contents of the FILE 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 FILE tag contents are passed
to the "get_file_text" function behind the scenes. Therefore, no unquoted
semicolons (;) should be placed inside a FILE tag, as it would prematurely
end the function call.
--------------
USAGE EXAMPLES
--------------
---------------------------------------------------------
Example 1: Loading a File by calling its Static File Name
---------------------------------------------------------
<?! "file.html" ?>
----------------------------------------------------------
Example 2: Loading a File from a Name Stored in a Variable
----------------------------------------------------------
<?! $file ?>
--------------------------------------------------------------------
Example 3: Loading ".html" Files 1-10 with the DO Tag and a For Loop
--------------------------------------------------------------------
<? for ($i = 1; $i <= 10; $i++) { ?>
<?! "$i.html" ?>
<? } ?>
|