File Reading

 

File Reading

We've already seen how a page can include a variable in the input and have this be inserted into the output.

There is a special kind of per-page variable, using read_file, which sets the value of a variable to the contents of the named file:

title: File Reading
src: read_file( file.wgn )
sidebar: read_file( sidebar.inc )
----
..

As a helper if you use "read_file( SELF )", then "SELF" will be replaced with the page being read.

File Inclusion

As an alternative to naming a part of your template, and expanding the content within it you can of course use the HTML::Template file inclusion construct:

  <!-- tmpl_include name='path.inc' -->

The inclusion path is relative to the directory containing the file being processed.


Show the source of this page.