Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-03-2013, 04:18 PM   PM User | #1
knightmetal
New Coder

 
Join Date: Sep 2012
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
knightmetal is an unknown quantity at this point
How to organize website files?

I've been reading different articles about the way to organize files and folders for websites. Unfortunately I don't seem to fully understand if there's something like the correct or the standard way to do it? All opinions are pretty much in the same path but I've seen they really depend on the complexity of the website, i.e. how large the contents are.

Based on what I've read here's how I'm organizing my files

Code:
root
   img
   js
   articles
                topic1
                         article1
                                   img                          
                                   index.html
                                   ...
                                   ...
                         article2
                         article3
                         ...
                         ...
                topic2
                topic3
                ...
                ...
   img
   resources
          classes
          libraries
          templates
          ...
index.php
contactus.php
error1.php
error2.php
...
...
I'd like to know if I'm in the right direction?
knightmetal is offline   Reply With Quote
Old 02-05-2013, 12:10 AM   PM User | #2
StevenHu
Regular Coder

 
Join Date: Jun 2011
Location: CA
Posts: 105
Thanks: 0
Thanked 10 Times in 10 Posts
StevenHu is an unknown quantity at this point
Well, will this format help you to find your files, or not? What is your criteria for organization?
__________________
Steve Husting
http://iphonedevlog.wordpress.com
StevenHu is offline   Reply With Quote
Old 02-05-2013, 04:22 AM   PM User | #3
gilgimech
New Coder

 
Join Date: Mar 2010
Posts: 58
Thanks: 10
Thanked 3 Times in 3 Posts
gilgimech is an unknown quantity at this point
No there's no real format for file structure. But there are best practices.
Code:
root
   css
   images
   js
That's about as basic as it gets. The real question is what is this site for? Is it your personal site, is it for a client, are other developers going to work on it?

If it's your own personal site. Structure it however you want. It only has to make sense to you and as long as you can find what you need it's all good.

If the site is for a client or if other developers are going to work on it. Just make sure it makes sense, and I wouldn't go too deep in the directories. Like two or three deep max.

also you have to keep the site's URLs in mind. Like in your example the index.html file in the articles dir will look like this.

httpp://www.yoursite.com/articles/topic1/article1/index.html

That's kind of an ugly URL.
gilgimech is offline   Reply With Quote
Users who have thanked gilgimech for this post:
knightmetal (02-05-2013)
Old 02-05-2013, 04:43 PM   PM User | #4
knightmetal
New Coder

 
Join Date: Sep 2012
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
knightmetal is an unknown quantity at this point
Guys, thanks for your comments

Code:
That's about as basic as it gets. The real question is what is this site for? Is it your personal site, is it for a client, are other developers going to work on it?

If it's your own personal site. Structure it however you want. It only has to make sense to you and as long as you can find what you need it's all good. 

If the site is for a client or if other developers are going to work on it. Just make sure it makes sense, and I wouldn't go too deep in the directories. Like two or three deep max.
I get your point. This particular site is mine, it's basically a place where I deal with topics about computers and that kind of stuff, so I'm starting to realize it is very important to maintain things in order from the very beginning as it might be hard for me to deal with a (potential) mess in case the site starts growing fast. My concern is basically in terms of scalability.

For instance, my site has an admin account, so because of that, files such as about.php, contact-us.php, index.php..., as well as my admin files are all in my root directory. That's why I started thinking of a way to organize my files, ideally using standards (if there's any) or just best practices. What I did was create folders for images, css, js, resources (classes, libs, config files, etc), and content (articles). Things look much better now.

On the other hand, these days I've been kind of building my portfolio, I really want to focus on good practices not only for myself but to show possible clients that my work is "professional".

Code:
also you have to keep the site's URLs in mind. Like in your example the index.html file in the articles dir will look like this.

httpp://www.yoursite.com/articles/topic1/article1/index.html

That's kind of an ugly URL.
You mean I shouldn't have called it index.html? I totally agree, and actually, that won't be its name. I just meant that that's the index page for my "article1", I do know it's not common and it does look ugly to have an index.html page the way I have it. In the end, that index page will have a proper name, something that matches the content of my article Is that what you meant?
knightmetal is offline   Reply With Quote
Old 02-05-2013, 07:41 PM   PM User | #5
gilgimech
New Coder

 
Join Date: Mar 2010
Posts: 58
Thanks: 10
Thanked 3 Times in 3 Posts
gilgimech is an unknown quantity at this point
Quote:
Originally Posted by knightmetal View Post
You mean I shouldn't have called it index.html? I totally agree, and actually, that won't be its name. I just meant that that's the index page for my "article1", I do know it's not common and it does look ugly to have an index.html page the way I have it. In the end, that index page will have a proper name, something that matches the content of my article Is that what you meant?
No, not quite. What I meant was the 'articles/topic1/article1/' part isn't very semantic. The more directories you add the longer thew URL will get. You should try to make your URL's as clean as possible.
gilgimech is offline   Reply With Quote
Old 02-06-2013, 10:06 AM   PM User | #6
knightmetal
New Coder

 
Join Date: Sep 2012
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
knightmetal is an unknown quantity at this point
Oh I get it, can you then recommend how I can organize that very same section? I just want my site to be as organized and well-distributed as possible. Here's a basic example of how the section would look like in the future,

http://www.yoursite.com/articles/top...le1/index.html

would look like (just an example)

http://www.tech.com/articles/computi...ndex-page.html
Code:
root
   articles
      computing
         fix-your-computer
            its-index-page.html
            one-more-page.html
            images
In my case, would you then remove one directory to make it look nicer (for instance, 'fix-your-computer' directory) and put everything about that first article in the 'computing' directory? Then the images for that first article would go in an 'images' sub-folder in the main 'images' folder (the one in root)?

That's what I would do to make it look nicer but but besides 'computing', there will be more categories. That's the thing. Any suggestions will be appreciated.
knightmetal is offline   Reply With Quote
Old 02-06-2013, 02:24 PM   PM User | #7
jerry62704
Senior Coder

 
jerry62704's Avatar
 
Join Date: Oct 2007
Location: Springfield, IL
Posts: 1,042
Thanks: 9
Thanked 81 Times in 81 Posts
jerry62704 is on a distinguished road
Here is how I would organize it:

root
\images\
\css\
\js\
\resources\
\pages\
\articles\
index.html

The difference between "pages" and "articles" is one is for the site (navigation, etc) and the other is for your specialized use. "Pages" would also contain such things as "not found" pages. You might also break out "images" in the same way with that holding stuff specific to your web pages (headers, footers, etc) and one for articles.
__________________
.
.
...and gladly would he learn and gladly teach

Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls
jerry62704 is offline   Reply With Quote
Old 02-06-2013, 03:58 PM   PM User | #8
knightmetal
New Coder

 
Join Date: Sep 2012
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
knightmetal is an unknown quantity at this point
Thanks Jerry, I'll keep that in mind.
knightmetal is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:13 PM.


Advertisement
Log in to turn off these ads.