Verzeichnisse und Dateien schön klar gegliedert:
(War mein erstes Skript überhaupt, also nicht böse bei Fehler sein):
?php
include_once $DOCUMENT_ROOT/vlib/vlibTemplate.php;
$tmpl = new vlibTemplate'index.tpl';
$tmpl-setVar'title', $PHP_SELF;
$tmpl-setVar'background_image', 'http//129.203.163.150/images/gray.gif';
$tmpl-setVar'link01', 'http//129.203.163.150/SelfHTML/';
$tmpl-setVar'link01_name', 'selfHTML';
$tmpl-setVar'link02', 'http//129.203.163.150/schul12/skripte/php_coding_standard.htm';
$tmpl-setVar'link02_name', 'PHP Coding Standard';
$tmpl-setVar'link03', 'http//129.203.163.150/phpMyAdmin/';
$tmpl-setVar'link03_name', 'phpMyAdmin';
$tmpl-setVar'link04', 'http//129.203.163.150/PHD/adm_index.php';
$tmpl-setVar'link04_name', 'PHD adm_index';
$handle = opendir.;
$ausfuehren = TRUE;
while $filename = readdir$handle
if $filename != . and $filename != .. and $filename != index.php
$ausfuehren = TRUE;
else
$ausfuehren = FALSE;
if dir == filetype$filename and TRUE == $ausfuehren
$dir_array = $filename;
else
if TRUE == $ausfuehren
$file_array = $filename;
closedir$handle;
if !isset$dir_array0
$dir_array0 = keins;
sort$dir_array;
sort$file_array;
if $file_array $dir_array
$max_rows = count$file_array;
else
$max_rows = count$dir_array;
$tabledata = array;
for $i = 0; $i $max_rows; $i++
array_push$tabledata,
array
'dir_name' = $dir_array$i,
'file_name' = $file_array$i
;
$tmpl-setloop'tabledata', $tabledata;
$tmpl-pparse;
?
Template:
html
head
titletmpl_var name='title'/title
/head
body background=tmpl_var name='background_image'
h1 align=centerWillkommen im tmpl_var name='title'/h1
hr
brbr
table align=center width=70% border=0
tr
tda href=tmpl_var name='link01'h2tmpl_var name='link01_name'/h2/a/td
tda href=tmpl_var name='link02'h2tmpl_var name='link02_name'/h2/a/td
/tr
tr
tda href=tmpl_var name='link03'h2tmpl_var name='link03_name'/h2/a/td
tda href=tmpl_var name='link04'h2tmpl_var name='link04_name'/h2/a/td
/tr
/table
br
table width=100%
tr
tdbVerzeichnisse/b/td
tdbDateien/b/td
/tr
tmpl_loop name='tabledata'
!-- loop start --
tr
tdfont size='+1'a href='tmpl_var name='dir_name'/'tmpl_var name='dir_name'/a/font/td
tda href='tmpl_var name='file_name''tmpl_var name='file_name'/a/td
/tr
!-- loop end --
/tmpl_loop
/table
/body
/html