a little update: Though i made a promise to post every two weeks, its been 4 weeks, why? ..is this… i was going in a flow, but things started affecting.. rather i let things affect me, lately lot of things happened personally, lot of things reminded of the past, that made me avoid _________ in the present,


Continuation.

Pick up where i left off from previous post: Let me explain the way of approach i wanted to do, i wanted to access all the files of the server, like i wanted to go back to the root directory, back before that, basically anywhere where i wanted, So DirectoryIterator seemed the best choice, We are in a directory, we have to list all the files and folders in the directory, how would you do that?. Directory iterator  in a foreach, since directory iterator displays everything, can be used, ex as shown below.

foreach (new DirectoryIterator($dir) as $files)

If im about to display the files and folders, they should have a nice ui, like an icon, so categorizing files and icons, i would call is_dir() else its a file, this would be fine for now, but for future everything will have to be categorize as images, mp3, video, etc. the icons can be converted into base 64 strings so can be packed into the same file, its quite big, but its worth it,

$fileWithImage = ($files->isDir())? $this->getLinkWithText( (images::folderImage . " " .$files->getFilename()), $this->generateQueryString( 'folder' ,$files->getPath() .'/' .$files->getFilename() )) : images::fileImage . " " .$files->getFilename();

Letme explain this first, first checking if its a file or folder, if its a file, attach file image with file name, then thats it, but if its a folder, we show a folder icon with name and the link so that while clicking will be able to move front and back, All the fancy functions are just there to make the life simpler, their names exactly tell what they do. for instance, getLinkWithText expects two parameters, first is the image with name, second is query the link (a href). for that generateQueryString function expects a name, then the path to put it in href, and that is literally it, for making a dynamic traversing structure, all this is enough, may be next time ill explain with code for the other functions.

for the time being..imona leave , -sorry.