ThePartsOfTemplateLibraryActuallyUsedInSlashCode: Difference between revisions
Jump to navigation
Jump to search
(Created page with "<h2>The Parts Of Template Library Actually Used In Slash Code</h2> Knowing this can save some time reading docs. <h3>Most coomonly used feature</h3> The most commonly used ...") |
m (added Category:Development using HotCat) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
[[CssWork]] parent | |||
<h2>The Parts Of Template Library Actually Used In Slash Code</h2> | <h2>The Parts Of Template Library Actually Used In Slash Code</h2> | ||
Knowing this can save some time reading docs. | Knowing this can save some time reading docs. | ||
<h3>Most | The template language keywords are always first and appear to be always uppercase. The normal variables all appear to be lowercase. | ||
<h3>Most commonly used feature</h3> | |||
The most commonly used feature is simply using the template library to print a variables value | The most commonly used feature is simply using the template library to print a variables value | ||
Line 29: | Line 33: | ||
Most of these are common straightforward programming constructs, except: | Most of these are common straightforward programming constructs, except: | ||
BLOCK - | BLOCK - (man Template::Manual::Directives) | ||
<pre> | |||
The "BLOCK"..."END" construct can be used to define template component | |||
blocks which can be processed with the "INCLUDE", "PROCESS" and "WRAPPER" | |||
directives. | |||
[% BLOCK tabrow %] | |||
<tr> | |||
<td>[% name %]<td> | |||
<td>[% email %]</td> | |||
</tr> | |||
[% END %] | |||
<table> | |||
[% PROCESS tabrow name='Fred' email='fred@nowhere.com' %] | |||
[% PROCESS tabrow name='Alan' email='alan@nowhere.com' %] | |||
</table> | |||
A "BLOCK" definition can be used before it is defined, as long as the | |||
definition resides in the same file. The block definition itself does not | |||
generate any output. | |||
</pre> | |||
PROCESS - (man Template::Manual::Directives) | |||
<pre> | |||
The PROCESS directive is similar to "INCLUDE" but does not perform any | |||
localisation of variables before processing the template. Any changes made | |||
to variables within the included template will be visible in the including | |||
template." from man Template::Manual::Directives | |||
</pre> | |||
[[Category:Development]] |
Latest revision as of 15:40, 15 March 2014
CssWork parent
The Parts Of Template Library Actually Used In Slash Code
Knowing this can save some time reading docs.
The template language keywords are always first and appear to be always uppercase. The normal variables all appear to be lowercase.
Most commonly used feature
The most commonly used feature is simply using the template library to print a variables value
The specific template library keywords found in Slash templates
(the numbers roughly correspond to frequency of use)
1 ELSE 1 FOR 1 INCLUDE 2 ELSE 3 BLOCK 3 FOREACH 3 SWITCH 4 ELSIF 4 FOR 6 UNLESS 8 END 8 PROCESS 72 CASE 176 IF
Most of these are common straightforward programming constructs, except:
BLOCK - (man Template::Manual::Directives)
The "BLOCK"..."END" construct can be used to define template component blocks which can be processed with the "INCLUDE", "PROCESS" and "WRAPPER" directives. [% BLOCK tabrow %] <tr> <td>[% name %]<td> <td>[% email %]</td> </tr> [% END %] <table> [% PROCESS tabrow name='Fred' email='fred@nowhere.com' %] [% PROCESS tabrow name='Alan' email='alan@nowhere.com' %] </table> A "BLOCK" definition can be used before it is defined, as long as the definition resides in the same file. The block definition itself does not generate any output.
PROCESS - (man Template::Manual::Directives)
The PROCESS directive is similar to "INCLUDE" but does not perform any localisation of variables before processing the template. Any changes made to variables within the included template will be visible in the including template." from man Template::Manual::Directives