Website Folder Location

I'm not going to ask what is the best way ...? since there can be several ways to do this, I just want to learn from your experience how to manage folders and files when creating a website? (note: I am not English, so I ask here, I cannot find suitable places for an answer).

I coded for many years, but always on my own, and I never talk about how people structure their site before.

As information, I create a structure file in the root of my site, struct.php, which contains common layouts shared by many pages on my website.

If the user types in http://mywebsite.com/folder/, he requests the index file of the requested folder, which simply contains the import of the 'struct' file, for other variable parts, such as web page metadata, by creating a folder called meta that contains a file for any data type (.title, .description, .keywords), and, of course, the structure file extracts the contents of this information file and displays them in the appropriate place in the document.

I feel comfortable with this structure because it has been using it for a long time. But I would really appreciate it if you would offer tips or useful links and / or tell how you manage your own site.

+7
source share
4 answers

This is my way of structuring the page:

application_name - views - controllers - modules - templates - config bootstrap.php framework // not important public // this is the DOCUMENT_ROOT - assets - javascript - css - images - uploads index.php .htaccess // if apache 
+3
source

Cm:

http://www.warmforestflash.com/blog/2009/10/folder-structure-and-project-organization-best-practices/

What are your best practice tips for a web application framework?

http://www.networkclue.com/internet/HTTP/website-best-practices.aspx

http://www.grouppolicy.biz/2010/07/best-practice-active-directory-structure-guidelines-part-1/

There are no strict rules - only the widely perceived "best practice", which depends on the volume and nature of your site.

As a rule, it’s good to structure your directories around the main content, distributing their extraneous areas in order of magnitude (the number of files for this type of content). As a rule, it helps navigation when editing your site, like everyone else.

It is usually best to have dedicated folders for different types of content, so Javascript (/ js), CSS (/ css), images (/ img), etc. With the help of your scripts (html, php or otherwise), a structure corresponding to their purpose / quantity.

Remember that URLs should not reflect the structure of folders. I suggest you place your directories / folders in such a way that they are ordered for someone who created / maintained the site, then more readable locations can be processed in .htaccess.

+1
source

Like your statement, no one can say which is better or not, since this is a very variational procedure. However, you can always improve your organization. Usually my file structure is as follows.

 Root -Lib -Js //Here goes my Javascript libaries, like Jquery -Php //Here foes my PHP libaries (If i have any) -Modules //My modules for my page, this could be page controllers, article systems ETC! -Pages -Articles -Etc, etc -Templates //My template files -Modules //Templates for my modules -Pages -Articles -Etc, etc index.tpl //Other templates -Init //This would contain database handlers etc. .htaccess index.php 

I hope to see other examples, maybe I can also organize my structure;)

0
source

When you design web pages, most of the time you use the framework.

The framework usually suggests or strongly recommends using a specific folder layout that might be reasonable to use.

So, the programmer really has no choice in terms of layout, if he does not build his site from scratch without any frameworks.

0
source

All Articles