Luke wrote:
Ok,
one folder on your webserver, and put all of the files that you want to
include on your website/system in this folder (also uploading into this
folder); just in the root of that folder, so say you wouldn't have anymore
folders under it.
Make a table called 'Files,' containing:
ID
Name
Type
true_location
virtual_location
(or similar depending on your needs, you might also want a folders table,
perhaps this will increase speed if you are visually displaying the entire
display system.)
the Name, name of the file
Type, type of file, I have this in just so i can easily tell what file it is
and what to do without having to execute more scripts.
true_location, the real location and filename of the file that is placed in
your file
virtual_location, made up location that forms your filesystem
The advantages of mapping real files in a virtual location is that you and
the user can interact with the virtual location like it is really mapped and
keep the versatility of MySQL. Since reading several pieces of
information from MySQL is much faster than reading from files to get it.
For an upload system you would need to write a PHP script on the upload of
the file to add entries to the table. If you are initially placing many
files in there you may want to write a perl/shell/php script to enter all of
the initial file entries for the table for you.
2008/9/12 Jochem Maas <jochem@xxxxxxxxxxxxx>
Luke schreef:
When I need to do 'filesystem' type things I use MySQL to map all of the
files. This offers lot's of versatility in that you could just make a
single
folder called filesystem and have all of your files in the root of that
folder - then use mysql to map virtual folders and structures and such.
I don't understand what you mean, can you elaborate?
2008/9/12 Jochem Maas <jochem@xxxxxxxxxxxxx>
Nathan Rixham schreef:
Jochem Maas wrote:
Nathan Rixham schreef:
Stut wrote:
maybe this is into coding standards and ethics.. but this may be
acceptable:
if( !defined('__DIR__') ) {
define('__DIR__' , dirname(__FILE__));
}
however realistically you'd have to do this in every file and nto just
in one include
which would give an error on second and subsequent define()s
yet if(!defined... it's already defined so won't be defined subsequent
times :)
my bad
still crap though
yes :-P
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
i just use DirectoryIterator combined with DOMDocument to create nested
deep directory listing xml files that I can use in any application; i
find the over head v low; and if it was to go high; I'd just cache the
results :p
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php