Across my sites, I try to use a common file structure. I even make sure that applications I decide to install or use use this file structure to some extent and if they dont use it, I dont use that application and write my own or find another. Simple.

photo credit: totalAldo
A common site structure is necassary in terms of the site shell and the generated content the site produces (HTML/CSS/JS etc…).
In terms of a site structure, here is one that I tend to try to find and use from a developers point of view. A site structure like the one listed below will help to maintain the site, address problems and ensure that each site component is individual from another.
/(root) - put all core files here. Each file here, should serve a clear, definitive function. For example, on a forum piece of software, you would have a profile page, viewforum page, index page, registration page etc….
/includes/ - this directory should contain functions and procedures in order for those files in root to function. Each file should be named relative to that file it is providing functions for. For example, on a forum piece of software, you would have profile_functions.php or registration_captcha.php etc…
/classes/ - this class directory should stand by itself as it houses frameworks to be used by your system. These are different from the functions and procedures as they stand by themselves, for example a template class or caching class.
/libs/ - this directory will be used to house premade script components. Examples of this are various WYSIWYG editors and smarty php template system. These are released as applications and each application should house itself in its own folder. For example; /libs/smarty/ or /libs/wysiwyg/.
/cache/ - not applicable for all sites. This directory should contain and be a temporary house for various component caching including template files, sql queries and even whole pages.
/images/ - this folder should store images which are vital for the application to function - not template related images. Therefore, any images which are not dependant on a style or design on the website should be placed here.
/styles/ - a directory which houses the template files of the system. Each completed site template should be stored in its own directory and may contain an images folder for that template to function. For example; /styles/my_style_name/images/ or /styles/a_different_style/.
/admin/ - it is likely that if you are building a site of this complexity, you may need an admin folder. Similary, the admin panel may need its own sub directories including those above, ’styles’, ‘includes’, ‘classes’, ‘libs’.
Of course, ALL SITES VARY and serve different purposes so you will not always need a complete file structure like the one mentioned above. In some cases, you may use an ‘/uploads/’ directory instead of ‘/images/’ for a free image host site.
Hopefully you understand how site structure is important and how having organised content is the way to success for easy additions and changes in the near future. It is also a logical from a programmers perspective that organization is key to a script running efficiently and properly.
Feel free to add your criticisms, a site structure you use or maybe just suggest some additions to the list above. Again, the list is endless as each site performs a different function, so I couldn’t have covered them all - infact, I’m probably not even scratching the surface.
3 Responses for "Using A Common Site Structure"
do you know there is any effect on seo with types of templates? things like creative seo is what im into you see. a site that talks about hybridlab and csc and things like that i found and that there pages are html led with some php drupal stuff.
The template methods mentioned above are purely developer / backend based.
In terms of SEO, there are various other templates to follow. I will show you these structures in a new post.
[...] This is a post expanding on the backend / developer site structure. [...]
Leave a reply
You must be logged in to post a comment.