Hi everyone,
I was hoping that a few individuals would spare a few minutes to critique a theoretical directory structure. The application is a small intranet that has a minimal amount of authentication (domain auth/fallback to basic in case your interested) and interaction with both MSSQL and MySQL databases. Its secondary functionality includes an address book (cache'd ldap results from local AD), IT Helpdesk as well as articles based upon a category/articles system.

I have listed the directory/file structure below. If i have been ambiguous on anything please ask any questions and I will be more than happy to answer.

Wrapped in PHP tags for readability.

../config.php * Below root level

/index.php

/classes * htaccess/webconfig protected.
	/AddressBook
		AddressBook.class.php
	/Authentication
		Authentication.class.php
	/Content
		Content.class.php
	/Helpdesk
		Helpdesk.class.php
	/Intranet
		Intranet.class.php
	/Sql
		MSSQL.class.php
		MySQL.class.php

/media
	/css
		stylesheet.general.css
	/img
		favicon.ico
		logo.gif
		homepage-background.jpg
	/js
		jquery-1.7.2.js

/templates
	/AddressBook
		viewAddressBook.php
		editAddressBookProfile.php
	/Content
		viewContentCategory.php
		viewContentArticle.php
	/Helpdesk
		viewHelpdeskIncidents.php
		addHelpdeskIncident.php
		viewHelpdeskIncident.php
	/Intranet
		header.php
		footer.php
		menu.php

Thanks.

    The capitalization of the different directory levels could lead to errors (/templates/Helpdesk/ instead of /Templates/Helpdesk/). Same remark about class names and template names. Naming conventions are often annoying but in the long run, they save time and errors.
    Other than that, I find the multiplication of subdirectories a bit OTT but if it's your way of working, it IS your call.

    ../config.php * Below root level 
    
    /index.php 
    
    /Classes * htaccess/webconfig protected. 
            AddressBook.class.php 
            Authentication.class.php 
            Content.class.php 
            Helpdesk.class.php 
            Intranet.class.php 
            MSSQL.class.php 
            MySQL.class.php 
    
    /media 
        /css 
            stylesheet.general.css 
        /img 
            favicon.ico 
            logo.gif 
            homepage-background.jpg 
        /js 
            jquery-1.7.2.js 
    
    /templates * htaccess/webconfig protected. 
            AddressBook.viewAddressBook.php 
            AddressBook.editAddressBookProfile.php 
            Content.viewContentCategory.php 
            Content.viewContentArticle.php 
            Helpdesk.viewHelpdeskIncidents.php 
            Helpdesk.addHelpdeskIncident.php 
            Helpdesk.viewHelpdeskIncident.php 
            Intranet.header.php 
            Intranet.footer.php 
            Intranet.menu.php  

      Thanks for taking the time to respond. I will take into consideration the naming convention and also the subdirectory depth.

        Depending on project scale and personal preference, you might want to consider the Pear approach to class names, where underscores basically convert to directory separators. E.g., the class Foo_Bar_Name would be in file "<path to class directory>/foo/bar/name.php". Then it's relatively simple to parse a class name in an __autoload() function and get its pathname.

          Hi NogDog, project scale is unfortunately quite massive. The dir/file/class structure above is only the bare minimum so in all likeliness an auto load will be used. So will take into consideration your input.

            In my current MVC framework (self made by iterating over 9 years) I manage autoload very simply. If the class name starts with a _ it's a model, if not it's a controller. There are of course naming conventions (/controller/controller..php and /model/model..php all lowercase). I manage the views differently (through an output buffer) so there is no need for the autoload. I never found a need to go for anything more complicated. I am sure you can find a simple way to name and locate your files to have simple autoload rules.

              Write a Reply...