What folder structure do you use?

Status
Not open for further replies.

gram3000

New Member
For developers and designers out there, is there any preferred folder structure used for storing images, css files, js files etc?
 

babyboy808

Member
Here's mine:

Code:
/ root
   / index.php
   / elements/
      / js/    
      / css/
      / lib/      
      / images/
 

gram3000

New Member
Hi Babyboy808,

Looks good, my own method badly needs an update:

index.php
style.css
javascript.js
robots.txt
rss.xml
sitemap.xml
/ media (all images, pdfs etc used in the content)
/ _images (images for the template only)
 

davkell

New Member
It's usually something like:

root/
/ index.php
/ scripts (sub-folders if lots of files / libraries being used)
/ styles
/ resources (if anything else is being used...e.g. pdf)
/ images
 

gram3000

New Member
Hi Davkell,

Looks good. I'd love to see more peoples approaches to this, I was thinking there might be a preferred structure such as those used in free or wordpress templates.
 

davkell

New Member
I'd normally use a structure like that if I'm doing a custom Wordpress theme too - I'd generally keep all that separate to the rest of the php theme files (although if you're distributing the theme for download you can't really set it up like that, but I guess you could use a directory structure like that in the theme folder)
 

kjt

New Member
I generally use

root/
/ index.php
/ css
/ imgs
/ js
/ files (anything downloadable)

Also if the site is less then 10/20 pages I'd put each within their own folder like:

/ Clients / index.php
/ Contact / index.php
/ About / index.php

:)
 

php.allstar

New Member
I use seperate subdomains for images, css and javascript/jquery

css.domain.com
images.domain.com
js.domain.com

Altough this results in 4 DNS lookups, this is within the acceptible range of 2 - 4 (the lower this number the better). This results in more parallel downloads, helping your pages load quicker.

As I work on Linux, I place sensitive php scripts in a directory below the root when creating my own applications, and I know most turnkey applications such as Wordpress, osCommerce etc, don't have this setup, but hey, thats how I go.
 
Status
Not open for further replies.
Top