Name

include — include file into the current page and reparse contents for tags

ATTRIBUTES

Attribute Pos. Req. Default Description
file Yes Yes Filename to include. Can only be a relative filename if NoAbsolute is set.
locale     1 Honor locales?
interpolate     0 interpolate output?
hide     0 Hide the tag return value?

DESCRIPTION

The tag inserts the contents of the named file, which is searched relative to the catalog root directory or any directories specified by the TemplateDir directive.

The file should normally be relative to the catalog directory. File names beginning with / or .. are not allowed if the Interchange server administrator has enabled NoAbsolute.

The maximum number of circular inclusions is controlled by the Limit directive, using key include_depth.

BEHAVIOR

This tag does not appear to be affected by, or affect, the rest of Interchange.

EXAMPLES

Example: Simple file include

[include /tmp/test]

Our /tmp/test file could look like this:

Time is [time].

NOTES

File contents are always loaded and interpolated before insertion into the source document. To include file without reparsing contents, use [file].

AVAILABILITY

include is available in Interchange versions:

4.6.0-5.9.0 (git-head)

SOURCE

Interchange 5.9.0:

Source: code/SystemTag/include.coretag
Lines: 38


# Copyright 2002-2007 Interchange Development Group and others
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# 
# $Id: include.coretag,v 1.8 2007-03-30 23:40:49 pajamian Exp $

UserTag include             Order        file locale
UserTag include             PosNumber    2
UserTag include             Version      $Revision: 1.8 $
UserTag include             Routine      <<EOR
sub {
my ($file, $locale) = @_;
$locale = 1 unless defined $locale;

$::Instance->{include_depth} ||= 0;
my $limit = $Vend::Cfg->{Limit}{include_depth} || 10;

if($::Instance->{include_depth}++ >= $limit) {
  logOnce(
      'error',
      "Depth of include (%s) exceeds limit of %s for file %s.", 
      $::Instance->{include_depth},
      $limit,
      $file,
    );
  return;
}

my $out = Vend::Interpolate::interpolate_html(
        Vend::Util::readfile($file, undef, $locale)
      );
$::Instance->{include_depth}--;
return $out;
}
EOR

AUTHORS

Interchange Development Group

SEE ALSO

file(7ic)

DocBook! Interchange!