Organizing php files in a root directory

This is kind of a unix question, but it has to do with how my files show up in a directory. I would like to force certain folders to the end of their listing in a directory. I have been using the rather awkward method of prefixing them with “zz_”. This works OK, but it makes for rather weird folder names. Is there some ascii character I can use as a prefix that will assure a directory with that prefix ends up at the bottom of the directory?

I know I can use an underilne (“_”) or a “~” to make them show up at the top of a directory listing (though I am not sure this is consistent with “~” which some systems seem to list at the bottom.).

My goal here is that I would like to force key directories like those containing classes, assets, css, views, js and others to the top of the list and less important directories like backup, test_files, etc. to the bottom of the list. This makes it a lot easier to quickly parse a directory that might have a lot of different kinds of files in it.

I would also be interested in tutorials or other resources with ideas about how to organize php files in a directory. I know certain frameworks impose certain kinds of organization; I am not using a framework and would like some ideas about good ways to organize php files in a directory.

–Kenoli

I think it sounds as though you need to distinguish between your code root, and your web root – unless you are performing some kind of magic with a sole index.php file (a la framework)

/var/www/includes/classes
/var/www/backup

Then from the webroot, all the assets that webpages need to function:

/var/www/html/websiteone/
/var/www/html/websiteone/js
/var/www/html/websiteone/css

Sorry if this is not what you mean – are you harking on about something else?

Are you talking about viewing the directory listing in the browser when you don’t have an index page?

Why is that order important?
If you’re talking about viewing things locally people just use search in their favorite text editors to find what they are looking for.

I’m talking about my code root. I am using a single index file that acts as a controller to generate most of the pages on the site. I have a bunch of classes instantiated and utilized by the controller as needed, a number of css files, javascript files, directories of images (the site displays artwork), various include files and scripts called by AJAX requests, html templates that are included in controller scripts, and more. And then there are certain files that I like to keep grouped, like administration scripts and shopping cart scripts. What I am looking for is some site organization as I modify file code. I want to make it easy to find files I need to work on with some good site organization.

I have not seen a lot of discussion of organizing code files in coding literature, probably because many people use frameworks which take car of this for them. I’m curious to read about what others are doing and thinking in this areas.

The question regarding the order in which UNIX sorts various leading characters in an alphabetical sort relates to my site organization, particularly regarding the directories that hold key files like classes and includes that I have to get to regularly. If I can name these directories so important ones, like classes, show up at the top of the sort and less important toward the bottom, it makes it easier to find what I am looking for. Getting files into directories is also helpful as there are a lot of free files floating around and making it hard to find files like the index file that has to be at the root of the directory.

Hope this clarifies my question.

–Kenoli