LoadHtml
view release on metacpan or search on metacpan
every occurrance of the parameter with the same name, ie. "-parm => 'value', converts
:{parm} or <!:parm> or <!:parm:>...<!:/parm> to 'value' everywhere it occurrs.
For each parameter that is used in a LOOP or SELECTLIST construct, the value should be
an array reference or a hash referehce, rather than a scalar value. If successful,
loadhtml returns 1 (true) if fails, ie. could not open the template file, <undef>.
The special parameter ":0" is replaced with the name of the template file (1st argument).
</P>
<P>You can also convert programs that use Template::Toolkit by changing:</P>
<P> $template_object->process($template_file, $template_hashref);</P>
<P>to:</P>
<P> &loadhtml($template_file, %{$template_hashref});</P>
<P> <B>&loadhtml($htmlfile, @args);</B></P>
<P>is equivalent to:</P>
<P> print &buildhtml($htmlfile, @args);</P>
<P> <B>my $html = &buildhtml($htmlfile, @args);</B></P>
<P>Same as loadhtml, except returns the generated webpage as a string instead of writing
it to STDOUT;</P>
<P> print &dohtml($htmlstring, @args);</P>
<P> <B>my $html = &dohtml($htmlstring, @args);</B></P>
<P>Same as buildhtml, except processes a input string instead of a template file or url.</P>
<P> <B>&AllowEvals(1|0);</B></P>
<P>Toggles whether or not embedded Perl variables and expressions are performed, namely
the <!PERL> and <EVAL> constructs and Perl variables in the format: "<!:$variable>".</P>
Default is 0.</P>
<P> <B>&set_poc($str);</B></P>
<P>Sets the string to replace the special "<POCS>" construct. Default is to ignore this
tag. If called without a string or an empty string, the string is set to
"your website administrator".</P>
<P> <B>&SetRegices(%optionshash);</B></P>
<P>Sets special control options. The currently defined options (with their default values)
are: -hashes => 0, -CGIScript => 0, -includes => 1, -embeds => 0, -loops => 1,
-numbers => 1, -pocs => 0, -perls => 0)</P>
<P>These options allow speeding up processing when turned off (not needed). </P>
<P> -hashes: Allows the <!HASH> tag sto be processed if on, otherwise ignored.</P>
<P> -CGIScript: Causes s special hidden form variable called "CGIScript" to be added at </P>
the bottom of the first form with the value set to "$ENV{SCRIPT_NAME}" if on, otherwise not added.</P>
<P> -includes: Allows the <!INCLUDE> tags to be processed if on, otherwise ignored.</P>
<P> -embeds: Allows the <!EMBED> tags to be processed if on, otherwise ignored.</P>
<P> -loops: Allows the <!LOOP> tags to be processed if on, otherwise ignored.</P>
<P> -numbers: Allows the classic numeric parameter (":1", ":2", etc.) tags to be processed if on, otherwise ignored.</P>
<P> -pocs: Allows the <!POC> tags to be processed if on, otherwise ignored.</P>
<P> -perls: Allows the <!PERL> tags to be processed if on, otherwise ignored.</P>
<P><B>&SetListSeperator($separator_string);</B></P>
<P>Sets the separator string to be used if an array-reference is passed to a parameter
that appears outside of a loop (where a scalar value is expected) Such values are
automatically converted to a string of values ala Perl's "join()" function. The default
string is ", ".</P>
<P> <B>&SetHtmlHome($htmlhome, $roothtmlhome, $hrefhtmlhome, $hrefcase);</B></P>
<P>This allows certain embedded links within a document to be "converted" for proper
handling. Relative links refer to a different path when the document is loaded via
CGI/LoadHTML than then they are loaded directly as urls by a browser, for example, the
document root usually becomes the directory the CGI script is in. Anyway, this is
an attempt to allow valid HTML pages to also be loaded as templates within a CGI script
and maintain their links properly.</P>
<P>$htmlhome - specifies the URL path to append to relative links in SRC=, HREF=, CL=, HT=, GROUND=,
and window.open() arguments.</P>
<P>$roothtmlhome specifies the filesystem path to append to relative file names in <INCLUDE> tags.</P>
<P>$hrefhtmlhome - similar to $htmlhome, but only applies to HREF= links, if it is
necessary to redirect them to a different path, ie. a cgi-script for pre-processing.
If both $hrefhtmlhome and $htmlhome are specified and non-empty, the former will override
for HREF= links and the other will applie to the other link types, ie. SRC=, etc.</P>
<P>$hrefcase - used to limit the substitutions of $htmlhome and $hrefhtmlhome to specific
links. It can be set to 'l' (Lower-case links only), left undefined for all links, or
set to anything else for Upper-case links only. For purposes of case, a "Lower-case" link
would be "href=", an "Upper-case" link would be "HREF=".</P>
<P> <B>&loadhtml_package($package_name);</B></P>
<P>Change the default package LoadHTML uses for embedded Perl variables. Default is main.
Best way to set this is to call "loadhtml_package(__PACKAGE__);".</P>
<H3>
<A NAME="Requirements"></A><FONT COLOR="#FFDEAD">VI). Minimum System
Requirements:</FONT></H3>
<UL>
<LI>1) Any system supporting Perl and CGI.
<LI>2) <A HREF="http://www.perl.com/download.csp">Perl, v.
5.003</A> or better.
<LI>3) Perl's "<A HREF="http://search.cpan.org/~gaas/libwww-perl-5.808/lib/LWP.pm">LWP</A>" module
(not an absolute requirement, but VERY useful) and required prerequesites: MIME-Base64
(MIME), HTML-Parser (HTML), libnet (Net), MD5, and Data-Dumper (Data).
All of these are available for download from <A HREF="http://www.cpan.org">CPAN</A>.
( run in 1.131 second using v1.01-cache-2.11-cpan-71847e10f99 )