PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Boutekedjiret   Navigator   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: an example
Class: Navigator
Browsing and manipulating directories and files
Author: By
Last change: new example for the new modifcations
Date: 20 years ago
Size: 1,927 bytes
 

Contents

Class file image Download
<div><a href='manual.html'>Manual</a> - <A href="mailto:zkara@users.sourceforge.net?Cc=dennis@nnsolutions.nl&subject=Navigator class">Suggestions or bugs ?</a></div><hr>
<?php
#
# Example to use Navigator class
#

include "class.navigator.php";

$base="..";


if(
$_GET[browse]!="") $base=urldecode($_GET[browse]);

$obj= new Navigator($base);

$obj->SortListD($_GET[sortby],$_GET[sortdir]);
$obj->SortListF($_GET[sortby],$_GET[sortdir]);

echo
"<h3>Browsing : <u>".$obj->Pwd()."</u> <i>size : ".$obj->ConvertSize($obj->GetDirSize($obj->Pwd()))." </i></h3>" ;

echo
"<table border=1>";
echo
"<tr><td colspan=6>Total Directories :".$obj->Count("d")."</td></tr>";
while(
$obj->NextDir())
{
echo
"<tr>";
echo
"<td><a href=\"$_SERVER[PHP_SELF]?browse=".urlencode($base."/$obj->FieldName")."\" >$obj->FieldName</a></td>";
echo
"<td>".$obj->FieldDate."</td>";
echo
"<td>".$obj->FieldSize."</td>";
echo
"<td>".$obj->FieldPerms."</td>";
echo
"<td>".$obj->FieldOwner."</td>";
echo
"<td>".$obj->FieldGroup."</td>";
echo
"</tr>";
}
echo
"</table>";

echo
"<br>";

echo
"<table border=1>";
echo
"<tr><td colspan=6>Total Files :".$obj->Count("f")."</td></tr>";
while(
$obj->NextFile())
{
echo
"<tr>";
echo
"<td>".$obj->FieldName."</td>";
echo
"<td>".$obj->FieldDate."</td>";
echo
"<td>".$obj->FieldSize."</td>";
echo
"<td>".$obj->FieldPerms."</td>";
echo
"<td>".$obj->FieldOwner."</td>";
echo
"<td>".$obj->FieldGroup."</td>";
echo
"</tr>";
}
echo
"</table>";


?>
<FORM ACTION="<?php echo $_SERVER[PHP_SELF];?>" METHOD="GET">
<SELECT name=sortby>
<option VALUE=N>By name</option>
<option VALUE=D>By Date</option>
<option VALUE=S>By Size</option>
</SELECT>
&nbsp;
<SELECT name=sortdir>
<option VALUE=ASC>Asc</option>
<option VALUE=DESC>Desc</option>
</SELECT>
&nbsp;
<INPUT TYPE=submit value=Sort>
<INPUT TYPE=hidden name=browse value=<?php echo $_GET[browse]?>>
</FORM>