GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEMPLATE_SYNTAX (3)

.ds Aq ’

NAME

template_syntax - description of the syntax of a Text::Tmpl template.

CONTENTS

SYNOPSIS

In general:

<!--#function argument1, $argument2, argu $ment 3--><!--#endfunction-->

Specifically:

<!--#echo text-->

<!--#include file-->

<!--#comment-->This won’t be printed<!--#endcomment-->

<!--#if value-->This will be printed if value is true<!--#endif-->

<!--#ifn value-->This will be printed if value is false<!--#endifn-->

<!--#loop loopname-->This may be printed a bunch of times<!--#endloop-->

<!--#debug--><!--#include debug-include.tmpl--><!--#enddebug-->

debug-include.tmpl:

Variables in this context: <!--#loop variables- $number-->

<!--#echo $variable_name--> == <!--#echo $variable_value-->

<!--#endloop-->

Named children (loops) in this context: <!--#loop named_children- $number-->

<!--#loop $nc_name--> <!--#echo $nc_name-->: <!--#include debug-include.tmpl--> <!--#endloop-->

<!--#endloop-->

DESCRIPTION

The specific tags listed above are merely the default tags in the template library. It is possible to add tags of your own.

The tag format is: open_tag_delimiter (default: <!--#) + function name + some whitespace + comma-separated argument list (described below) + close_tag_delimiter (default: -->).

Each argument in the comma-separated argument list consists of variables and strings - everything else is ignored. A variable looks like $foo, where foo is any number of alphanumeric characters. A string is anything (including whitespace, newlines, etc...) within double-quotes. To put literal double quotes into a string, escape with a backslash. For example, the following list:

argument1, $argument2, argu $ment 3

would become:

argument1, (the value of $argument2), argu(the value of $ment)3

Tag pair nesting is possible (and infinite, at least if you have an infinite stack...) Also, the result of a simple tag evaluation will actually be parsed again, so you can (for example) include another template into the current one, and it will be parsed.
<B>echoB> The echo tag is replaced by the concatenated string values of each of its arguments.
<B>includeB> The include tag is replaced by the contents of the named file.
<B>commentB> / <B>endcommentB> The comment/endcomment tag pair, and everything it contains, is replaced by nothing.
<B>ifB> / <B>endifB> The if/endif tag pair, and everything it contains, is replaced by nothing or by the complete contents of the tag pair, depending on the truth of the first argument to the tag. If the argument is true, the complete contents of the tag pair are output - otherwise, nothing is output.
<B>ifnB> / <B>endifnB> The ifn/endifn tag pair, and everything it contains, is replaced by nothing or by the complete contents of the tag pair, depending on the truth of the first argument to the tag. If the argument is false, the complete contents of the tag pair are output - otherwise, nothing is output.
<B>loopB> / <B>endloopB> The loop/endloop tag pair is replaced by everything it contains, repeated 0 or more times. The first argument to the loop tag is the name of the loop, and the number of repetitions is equal to the number of times that loop_iteration() was called in the current context with that loop name as an argument.
<B>debugB> / <B>enddebugB> The debug/enddebug tag pair is replaced by everything it contains. This pair also dumps all of the information about the parent context into this sub-context, so that you can see the internal state of the context as output. The format for using the debug/enddebug tag pair is shown in the SYNOPSIS above.

BUGS

Hopefully none.

AUTHOR

J. David Lowe, dlowe@saturn5.com

SEE ALSO

libtmpl(1), Text::Tmpl(1), template_extend(1)
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TEMPLATE_SYNTAX (3) 2003-02-06

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.