Autoload
Sets a macro that will be automatically executed before every page request.
Synopsis
or
Autoload <<EOA
Interchange tags here
EOA
|
The macro can be specified using the name of a Sub
or GlobalSub subroutine,
or it can be a block of Interchange tags.
Perl subroutines are much more efficient, of course.
Scope
This directive is only available for use in the local
(catalog.cfg) configuration file.
It will not affect any other website in any way.
This directive will not work in the global
(interchange.cfg) configuration file.
Description
Sets a macro that will be automatically executed before every page request.
The macro will be before any page parsing occurs,
and before the action or page name is even determined,
but only after the Preload macro (if defined)
has been executed.
Any value returned by the macro will be discarded.
|
Note
As of Interchange 5.4, you can to add multiple
Autoload and AutoEnd calls on separate lines.
Prior to version 5.4, you could only specify one instance of each of the
directives.
|
Also see the similar Preload directive.
Examples
Remap any
mv_nextpage
accesses to a "private" subdirectory of the PageDir:
Autoload <<EOA
[calcn]
$CGI->{mv_nextpage} =~ s:^private/:public/:;
undef;
[/calcn]
EOA
|
Temporarily change any of the website configuration settings.
For example, to use a different flypage,
depending upon the user's browser:
Autoload <<EOA
[calcn]
if ($Session->{browser} =~ /msie/i) {
$Config->{Special}->{flypage} = 'msie_flypage';
}
undef;
[/calcn]
EOA
|
|
Note
Please note that the "Special" hash key, in the previous example,
is associated with the SpecialPage directive.
This is an exceptional case;
Usually the hash key has the same name as the website's local
configuration directive.
|
See also