file — include file into the current page verbatim


Attribute Pos. Req. Default Description
name Yes Yes Filename to include. Can't be arbitrary file if NoAbsolute is set.
type Yes File type: unix, mac or [dos|windows].
interpolate     0 interpolate output?
hide     0 Hide the tag return value?


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.

File contents are inserted verbatim and not reparsed for tags.


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


Example: Simple file include

[file /tmp/test]
[file name=/tmp/test interpolate=1]

Our /tmp/test file could look like this:

Time is [time].

In the first line of the example, [time] will not be expanded to the actual time. In the third line it will, thanks to interpolate=1.


To reparse file contents upon inclusion, use [include] or [file name=NAME interpolate=1].


file is available in Interchange versions:

4.6.0-5.9.0 (git-head)


Interchange 5.9.0:

Source: code/SystemTag/file.coretag
Lines: 37

# 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: file.coretag,v 1.6 2007-03-30 23:40:49 pajamian Exp $

UserTag file                Order        name type
UserTag file                PosNumber    2
UserTag file                Version      $Revision: 1.6 $
UserTag file                Routine      <<EOR
sub {
my ($file, $type) = @_;
  return readfile($file)
  unless $type;
return readfile($file, undef, 0)
  if $type eq 'raw';
my $text = readfile($file);
if($type =~ /mac/i) {
  $text =~ tr/\n/\r/;
elsif($type =~ /dos|window/i) {
  $text =~ s/\n/\r\n/g;
elsif($type =~ /unix/i) {
  if($text=~ /\n/) {
    $text =~ tr/\r/\n/;
  else {
    $text =~ s/\r\n/\n/g;
return $text;


Interchange Development Group



DocBook! Interchange!