Results 1 to 3 of 3

Thread: Website Structure and Naming Conventions

  1. #1
    Join Date
    Apr 2012
    Location
    Chester, Cheshire
    Posts
    329
    Thanks
    7
    Thanked 35 Times in 35 Posts

    Default Website Structure and Naming Conventions

    Hi,

    I know it probably doesn't matter too much, but is there any "industry standard" for how set structure a website, so far as it's directories, filenames (et al) go.

    At the moment, I have my pet project site set up like this:

    Code:
     Volume in drive C has no label.
     Volume Serial Number is 0000-0000
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website
    
    17/06/2012  04:33    <DIR>          .
    17/06/2012  04:33    <DIR>          ..
    17/06/2012  01:18    <DIR>          admin
    16/06/2012  23:19    <DIR>          assets
    17/06/2012  18:17    <DIR>          db
    17/06/2012  01:12               191 about.php
    16/06/2012  23:23               196 concerts.php
    16/06/2012  23:23               196 contact.php
    16/06/2012  23:23               196 dance.php
    17/06/2012  18:06             1,708 default.php
    16/06/2012  23:23               196 festivals.php
    16/06/2012  23:43               196 links.php
    16/06/2012  23:23               196 music.php
    17/06/2012  19:10            48,249 web.config
                  11 File(s)         51,324 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\admin
    
    17/06/2012  01:18    <DIR>          .
    17/06/2012  01:18    <DIR>          ..
    17/06/2012  19:33             1,116 index.php
                   1 File(s)          1,116 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets
    
    16/06/2012  23:19    <DIR>          .
    16/06/2012  23:19    <DIR>          ..
    16/06/2012  23:18    <DIR>          css
    16/06/2012  23:18    <DIR>          images
    16/06/2012  23:18    <DIR>          scripts
    16/06/2012  23:19    <DIR>          templates
    21/04/2012  00:02               239 index.htm
                   1 File(s)            239 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\css
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    17/06/2012  19:42             6,899 base.css
    21/04/2012  00:02               239 index.htm
                   4 File(s)          7,138 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    16/06/2012  23:18    <DIR>          adverts
    17/06/2012  09:11    <DIR>          backgrounds
    16/06/2012  23:18    <DIR>          covers
    16/06/2012  23:18    <DIR>          icons
    16/06/2012  23:18    <DIR>          logos
    16/06/2012  23:18    <DIR>          site
    21/04/2012  00:02               239 index.htm
                   1 File(s)            239 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\adverts
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    21/04/2012  00:02               239 index.htm
                   1 File(s)            239 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\backgrounds
    
    17/06/2012  09:11    <DIR>          .
    17/06/2012  09:11    <DIR>          ..
    21/04/2012  00:02               239 index.htm
                   3 File(s)        434,230 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\covers
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    15/04/2012  19:12                45 index.html
                   5 File(s)        413,607 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\icons
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    15/04/2012  03:18             5,686 favicon.ico
    21/04/2012  00:02               239 index.htm
                   2 File(s)          5,925 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\logos
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    21/04/2012  00:02               239 index.htm
                   4 File(s)         34,540 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\site
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    21/04/2012  00:02               239 index.htm
                   5 File(s)         31,840 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\scripts
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    18/03/2010  20:43           168,792 jquery-1.4.1.js
    18/03/2010  20:43            71,922 jquery-1.4.1.min.js
    18/03/2010  20:43           242,990 jquery-1.4.1-vsdoc.js
    17/06/2012  08:58               370 scripts.js
                   3 File(s)        484,074 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\templates
    
    16/06/2012  23:19    <DIR>          .
    16/06/2012  23:19    <DIR>          ..
    21/04/2012  00:02               239 index.htm
    17/06/2012  00:15               689 overall_footer.php
    17/06/2012  05:16             3,664 overall_header.php
                   3 File(s)          4,592 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\db
    
    17/06/2012  18:17    <DIR>          .
    17/06/2012  18:17    <DIR>          ..
    17/06/2012  08:37         3,358,720 Database.mdb
    21/04/2012  00:02               239 index.htm
                   2 File(s)      3,358,959 bytes
    
         Total Files Listed:
                  49 File(s)      4,838,119 bytes
                  44 Dir(s)
    I have redacted and changed some of the more sensitive information, files and folders, but the overall layout is the same. Is this the way I should be laying out my site, or is there a better way.

    I have a fix for finding relative paths in PHP so I'm not worried about deep stacking directories, but I'd like to know of any file naming conventions and best practices. I remember a conversation on here with some of you about whether it's better to have a few small files or one large one, for css/js/php functions.

    What do people think?

  2. #2
    Join Date
    Jun 2012
    Posts
    12
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Hi,
    Try look on the net for: " php mvc pattern ". it is a standard in profesional php web building.

  3. #3
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by ApacheTech View Post
    Hi,

    I know it probably doesn't matter too much, but is there any "industry standard" for how set structure a website, so far as it's directories, filenames (et al) go.

    At the moment, I have my pet project site set up like this:

    Code:
     Volume in drive C has no label.
     Volume Serial Number is 0000-0000
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website
    
    17/06/2012  04:33    <DIR>          .
    17/06/2012  04:33    <DIR>          ..
    17/06/2012  01:18    <DIR>          admin
    16/06/2012  23:19    <DIR>          assets
    17/06/2012  18:17    <DIR>          db
    17/06/2012  01:12               191 about.php
    16/06/2012  23:23               196 concerts.php
    16/06/2012  23:23               196 contact.php
    16/06/2012  23:23               196 dance.php
    17/06/2012  18:06             1,708 default.php
    16/06/2012  23:23               196 festivals.php
    16/06/2012  23:43               196 links.php
    16/06/2012  23:23               196 music.php
    17/06/2012  19:10            48,249 web.config
                  11 File(s)         51,324 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\admin
    
    17/06/2012  01:18    <DIR>          .
    17/06/2012  01:18    <DIR>          ..
    17/06/2012  19:33             1,116 index.php
                   1 File(s)          1,116 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets
    
    16/06/2012  23:19    <DIR>          .
    16/06/2012  23:19    <DIR>          ..
    16/06/2012  23:18    <DIR>          css
    16/06/2012  23:18    <DIR>          images
    16/06/2012  23:18    <DIR>          scripts
    16/06/2012  23:19    <DIR>          templates
    21/04/2012  00:02               239 index.htm
                   1 File(s)            239 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\css
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    17/06/2012  19:42             6,899 base.css
    21/04/2012  00:02               239 index.htm
                   4 File(s)          7,138 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    16/06/2012  23:18    <DIR>          adverts
    17/06/2012  09:11    <DIR>          backgrounds
    16/06/2012  23:18    <DIR>          covers
    16/06/2012  23:18    <DIR>          icons
    16/06/2012  23:18    <DIR>          logos
    16/06/2012  23:18    <DIR>          site
    21/04/2012  00:02               239 index.htm
                   1 File(s)            239 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\adverts
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    21/04/2012  00:02               239 index.htm
                   1 File(s)            239 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\backgrounds
    
    17/06/2012  09:11    <DIR>          .
    17/06/2012  09:11    <DIR>          ..
    21/04/2012  00:02               239 index.htm
                   3 File(s)        434,230 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\covers
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    15/04/2012  19:12                45 index.html
                   5 File(s)        413,607 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\icons
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    15/04/2012  03:18             5,686 favicon.ico
    21/04/2012  00:02               239 index.htm
                   2 File(s)          5,925 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\logos
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    21/04/2012  00:02               239 index.htm
                   4 File(s)         34,540 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\images\site
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    21/04/2012  00:02               239 index.htm
                   5 File(s)         31,840 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\scripts
    
    16/06/2012  23:18    <DIR>          .
    16/06/2012  23:18    <DIR>          ..
    18/03/2010  20:43           168,792 jquery-1.4.1.js
    18/03/2010  20:43            71,922 jquery-1.4.1.min.js
    18/03/2010  20:43           242,990 jquery-1.4.1-vsdoc.js
    17/06/2012  08:58               370 scripts.js
                   3 File(s)        484,074 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\assets\templates
    
    16/06/2012  23:19    <DIR>          .
    16/06/2012  23:19    <DIR>          ..
    21/04/2012  00:02               239 index.htm
    17/06/2012  00:15               689 overall_footer.php
    17/06/2012  05:16             3,664 overall_header.php
                   3 File(s)          4,592 bytes
    
     Directory of C:\Users\ApacheTech\Documents\Visual Studio 2010\WebSites\PHP Website\db
    
    17/06/2012  18:17    <DIR>          .
    17/06/2012  18:17    <DIR>          ..
    17/06/2012  08:37         3,358,720 Database.mdb
    21/04/2012  00:02               239 index.htm
                   2 File(s)      3,358,959 bytes
    
         Total Files Listed:
                  49 File(s)      4,838,119 bytes
                  44 Dir(s)
    I have redacted and changed some of the more sensitive information, files and folders, but the overall layout is the same. Is this the way I should be laying out my site, or is there a better way.

    I have a fix for finding relative paths in PHP so I'm not worried about deep stacking directories, but I'd like to know of any file naming conventions and best practices. I remember a conversation on here with some of you about whether it's better to have a few small files or one large one, for css/js/php functions.

    What do people think?

    With external files, I tend towards making files which have all of the same kind of thing for them. For example, if I had a bunch of CSS rules for the header of my page, a bunch for the footer, and a bunch for the footer, I'd have 3 stule sheets, header.css, content.css and footer.css. Same thing with external javascrpt files, if I had a bunch of functions to do three different things, I'd have three external scripts.

    That's just how I do it though, others may just have one big file, but I do it so that I can find specific things quickly and therefore speed up my working time, it'd be interesting to see how much of coding time is taken up by looking for rules or functions.

    As far as I've seen throuout the web, that's how most websites seem to do it, it's just to inneficient with space or time to make one large file or lots of little files. But the actuall structuring tends to be along the lines of HTML files and then folders for JavaScript and CSS. As far as file naming goes, I remember reading an article about it the other day which was something along the lines of using Camelback case, eg
    HeaderContent.css
    So each word has the first letter capitalized, or
    header-content.css
    As far as im aware it's frowned upon to put spaces in file names.

    Hope that helped,
    Bernie
    Last edited by bernie1227; 06-27-2012 at 10:07 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •