diner - THE HTTP-server for the BeOS
Contents

[ CGI ]
[ Include ]
[ List ]
[ Query ]

[ Up ]

List

This module is able to list a given directory on disk. To do this, the content of the given block is repeated for every entry found and the variables are filled either by the attributes attached to that file or by some custom attributes like the name of that file.

The List module uses some additional header arguments, that can be given in the <Block> tag right after the module name.

"Path=Whatever"This specifies which directory to list, where "Whatever" is the absolute path to that directory.
"ListFiles=false"This turns of the listing of files and shows directories only.
"ListDirectories=false"This turns of the listing of directories and shows files only.
"CheckExistence=true"If this argument is given, no directory listing is generated, but instead it is checked wether the List statement would generate output. If not, the whole block is removed. With this, it is easy to remove a complete block if the contained listing wouldn't produce any output anyway.

The variables given are either some special variables or the name of the attribute to show. Currently, the only special variable is "name" which will be replaced by the name of the file or directory shown.

Now, have a look at an example, and don't miss the included example pages :

.
.
<Block List "Path=/boot/home/config/settings/NetPositive/Bookmarks" ListDirectories=false CheckExistance=true>
<table cellpadding=5 border=0 width=100%>
<tr>
<th bgcolor="blue"><font color="white">Name</font></th>
<th bgcolor="blue"><font color="white">URL</font></th>
</tr>

<Block List "Path=/boot/home/config/settings/NetPositive/Bookmarks" ListDirectories=false>
<tr> <td bgcolor="#f0d000"><font color="black"><Var name></font></td>
<td bgcolor="#f0d000"><font color="black"><a href=<Var META:url>><Var META:url></a></font></td>
</tr>
</Block>
</Block>
.
.

would result in the page

.
.

.
.

if no files exist at all, or for example in the page

.
.
<table cellpadding=5 border=0 width=100%>
<tr>
<th bgcolor="blue"><font color="white">Name</font></th>
<th bgcolor="blue"><font color="white">URL</font></th>
</tr>
<tr>
<td bgcolor="#f0d000"><font color="black">Lens Reviews</font></td>
<td bgcolor="#f0d000"><font color="black"><a href=http://mypage.direct.ca/c/cyuill/equiprev.htm>http://mypage.direct.ca/c/cyuill/equiprev.htm </a></font></td>
</tr>
</table>
.
.
Copyright © 1997-99 Stegemann & Co., Inc., all rights reserved.
Created: November 29, 1997. Last modified: April 30, 1999.