.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Display 3" .TH Display 3 "2001-10-24" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Slash::Display \- Display library for Slash .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& slashDisplay('some template', { key => $val }); \& my $text = slashDisplay('template', \e%data, 1); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Slash::Display uses Slash::Display::Provider to provide the template data from the Slash::DB \s-1API\s0. .PP It will process and display a template using the data passed in. In addition to whatever data is passed in the hashref, the contents of the user, form, and static objects, as well as the \f(CW%ENV\fR hash, are available. .PP \&\f(CW\*(C`slashDisplay\*(C'\fR will print by default to \s-1STDOUT\s0, but will instead return the data if the third parameter is true. If the fourth parameter is true, \s-1HTML\s0 comments surrounding the template will \s-1NOT\s0 be printed or returned. That is, if the fourth parameter is false, \&\s-1HTML\s0 comments noting the beginning and end of the template will be printed or returned along with the template. .PP Template for more information about templates. .SH "EXPORTED FUNCTIONS" .IX Header "EXPORTED FUNCTIONS" .Sh "slashDisplay(\s-1NAME\s0 [, \s-1DATA\s0, \s-1OPTIONS\s0])" .IX Subsection "slashDisplay(NAME [, DATA, OPTIONS])" Processes a template. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1NAME\s0" 4 .IX Item "NAME" .PD Can be either the name of a template block in the Slash \s-1DB\s0, or a reference to a scalar containing a template to be processed. In both cases, the template will be compiled and the processed, unless it has previously been compiled, in which case the cached, compiled template will be pulled out and processed. .IP "\s-1DATA\s0" 4 .IX Item "DATA" Hashref of additional parameters to pass to the template. Default passed parameters include constants, env, user, and form, which can be overriden (see \f(CW\*(C`_populate\*(C'\fR). .IP "\s-1OPTIONS\s0" 4 .IX Item "OPTIONS" Hashref of options. Currently supported options are below. If \s-1OPTIONS\s0 is the value \f(CW1\fR instead of a hashref, that will be the same as if the hashref were \f(CW\*(C`{ Return => 1 }\*(C'\fR. .RS 4 .IP "Return" 4 .IX Item "Return" Boolean for whether to print (false) or return (true) the processed template data. Default is print. .IP "Nocomm" 4 .IX Item "Nocomm" Boolean for whether to include (false) or not include (true) \&\s-1HTML\s0 comments surrounding template, stating what template block this is. Default is to include comments if the var \&\*(L"template_show_comments\*(R" is true, to not include comments if it is false. It is true by default. .IP "Section" 4 .IX Item "Section" Each template is assigned to a section. This section may be a section defined as a site section, or some arbitrary section name. By default, the section that is used is whatever section the user is in, but it can be overridden by setting this parameter. If a template in the current section is not found, it defaults to section \*(L"default\*(R". .Sp Section will also default first to \*(L"light\*(R" if the user is in light mode (and fall back to \*(L"default,\*(R" again, if no template for the \&\*(L"light\*(R" section exists). .Sp A Section value of \*(L"\s-1NONE\s0\*(R" will cause no section to be defined, so \&\*(L"default\*(R" will be used. .IP "Page" 4 .IX Item "Page" Similarly to sections, each template is assigned to a page. This section may be a page defined in the site, or some arbitrary page name. By default, the page that is used is whatever page the user is on (such as \*(L"users\*(R" for \*(L"users.pl\*(R"), but it can be overridden by setting this parameter. If a template in the current page is not found, it defaults to page \*(L"misc\*(R". .Sp A Page value of \*(L"\s-1NONE\s0\*(R" will cause no page to be defined, so \&\*(L"misc\*(R" will be used. .RE .RS 4 .RE .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" If \s-1OPTIONS\-\s0>{Return} is true, the processed template data. Otherwise, returns true/false for success/failure. .IP "Side effects" 4 .IX Item "Side effects" Compiles templates and caches them. .SH "NON-EXPORTED FUNCTIONS" .IX Header "NON-EXPORTED FUNCTIONS" .Sh "get_template(\s-1CONFIG1\s0, \s-1CONFIG2\s0)" .IX Subsection "get_template(CONFIG1, CONFIG2)" Return a Template object. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1CONFIG1\s0" 4 .IX Item "CONFIG1" .PD A hashref of options to pass to Template\->new (will override any defaults). .IP "\s-1CONFIG2\s0" 4 .IX Item "CONFIG2" A hashref of options to pass to Slash::Display::Provider\->new (will override any defaults). .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" A Template object. See \*(L"\s-1TEMPLATE\s0 \s-1ENVIRONMENT\s0\*(R". .SH "PRIVATE FUNCTIONS" .IX Header "PRIVATE FUNCTIONS" .Sh "_populate(\s-1DATA\s0)" .IX Subsection "_populate(DATA)" Put universal data stuff into each template: constants, user, form, env. Each can be overriden by passing a hash key of the same name to \&\f(CW\*(C`slashDisplay\*(C'\fR. .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .IP "\s-1DATA\s0" 4 .IX Item "DATA" .PD A hashref to be populated. .RE .RS 4 .RE .IP "Return value" 4 .IX Item "Return value" Populated hashref. .SH "TEMPLATE ENVIRONMENT" .IX Header "TEMPLATE ENVIRONMENT" .Sh "Preferences" .IX Subsection "Preferences" The template has the options \s-1PRE_CHOMP\s0 and \s-1POST_CHOMP\s0 set by default. You can change these in the \fBvars\fR table in your database (template_pre_chomp, template_post_chomp). Also look at the template_cache_size variable for setting the cache size. Template for more information. The cache will be disabled entirely if cache_enabled is false. .Sh "Plugin" .IX Subsection "Plugin" The template provider is Slash::Display::Provider, and the plugin module Slash::Display::Plugin can be referenced by simply \*(L"Slash\*(R". .Sh "Additional Ops" .IX Subsection "Additional Ops" Additional scalar ops (which are global, so they are in effect for every Template object created, from this or any other module) include \f(CW\*(C`uc\*(C'\fR, \f(CW\*(C`lc\*(C'\fR, \f(CW\*(C`ucfirst\*(C'\fR, and \f(CW\*(C`lcfirst\*(C'\fR, which all do what you think. .PP .Vb 1 \& [% myscalar.uc %] # return upper case myscalar .Ve .PP \&\f(CW\*(C`substr\*(C'\fR accepts 1 or 2 args, for the two corresponding forms of the perl function \f(CW\*(C`substr\*(C'\fR. .PP .Vb 2 \& [% myscalar.substr(2) # all but first two characters %] \& [% myscalar.substr(2, 1) # third character %] .Ve .PP Additional list ops include \f(CW\*(C`rand\*(C'\fR, which returns a random element from the given list. .PP .Vb 1 \& [% mylist.rand %] # return single random element from mylist .Ve .Sh "Additional Filters" .IX Subsection "Additional Filters" Also provided are some filters. The \f(CW\*(C`fixurl\*(C'\fR, \f(CW\*(C`fixparam\*(C'\fR, \f(CW\*(C`fudgeurl\*(C'\fR, and \f(CW\*(C`strip_*\*(C'\fR filters are just frontends to the functions of those names in the Slash \s-1API:\s0 .PP .Vb 3 \& [% FILTER strip_literal %] \& I think that 1 > 2! \& [% END %] .Ve .PP See Slash::Utility::Data for a complete list of available \f(CW\*(C`strip_*\*(C'\fR filters, and descriptions of each. .PP Note that [% var | filter %] is a synonym for [% \s-1FILTER\s0 filter; var; \s-1END\s0 %]: .PP .Vb 1 \& .Ve .PP It might seem simpler to just use the functional form: .PP .Vb 2 \& [% form.something | strip_nohtml # filter %] \& [% Slash.strip_nohtml(form.something) # function %] .Ve .PP But we might make it harder to use the Slash plugin (see Slash::Display::Plugin) in the future (perhaps only certain seclevs?), so it is best to stick with the filter, which is most likely faster anyway. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fITemplate\fR\|(3), \fISlash\fR\|(3), \fISlash::Utility\fR\|(3), \fISlash::DB\fR\|(3), \&\fISlash::Display::Plugin\fR\|(3), \fISlash::Display::Provider\fR\|(3).