File Patterns

 

File Patterns

There is a special kind of per-page variable, using file_glob, which sets up a data-structure which is used for a list. Lists are documented fully in the HTML::Template documentation, but in brief if you have this structure:

index.wgn
IMAGE1.jpg
IMAGE2.jpg
IMAGE3.jpg

You can setup a loop to hold the names of each file via:

files: file_glob( "IMAGE*.jpg" )

Then this, in your template, will allow you to see each of them:

  <!-- tmpl_loop name='files' -->
   <img src= "<!-- tmpl_var name='file' -->">
  <!-- /tmpl_loop -->

Here is a live example:


Show the source of this page.