Web Development Portfolio - Darren Peter Smith
 

Darren Peter Smith's Web Development Lab

Directory Browser


The code for this application is split into two parts, the PHP coding and the javascript enhancements (using the jQuery framework). The PHP can run independently from the javascript and will do so if javascript has been disabled by the user.

<noscript>
<?php include('Controllers/DirBrowseController.php'); ?>
</noscript>

The PHP architecture was based on MVC to keep the code tidy and easy to extend and this application seemed to lend itself well to this approach. This was a simple implementation of the MVC approach with just a single controller and two views. There are also several class files which form the model part of the application. The application reads and writes files directly to a folder on the server with the class files containing the necessary code for accessing this data.

$directory_browser = new DirectoryBrowser($requested_leaf, 
                                                 $allowed_root);

if($directory_browser->getDirectoryIsFound())
{
$data['files'] = 
  $directory_browser->getDirectoryLoader()->getFilesAsArray();
  ...