SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    How do you organize your files?

    How do you organize your files for your website??

    I'm doing basic procedural programming. (No fancy OOP or MVC stuff, so no show-offs!!)

    Also, I am trying to put as much stuff into a MySQL database as possible.

    Even with that, there are a lot of "one-off" files that are mucking up my Document Root.

    For example, I have...
    Code:
    index.php
    log_in.php
    create_account.php
    workshops.php
    my_account.php
    contact_us.php
    ...and so on.


    Questions:
    1.) Should I file away those odd, "one-off" files into new directories (e.g. "account", "help", "Admin")?


    2.) Should I leave them in the Document Root?


    3.) Should they somehow go into my database?


    4.) Other?

    --------
    My website will be content-heavy, so a lot of things will fit into my database (e.g. Articles, Case Studies, Interviews, How-To's). However, it is becoming obvious that there are a lot of other web pages that don't have a good "home" currently.

    How do MEGA-sites like SitePoint, Yahoo, CNN, etc do things?

    Thanks,


    Debbie

  2. #2
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    How do you organize your files for your website??
    You'll find there is no right or wrong way to organise your files as it also depends on the size (total number of all files) of your website.

    For "small" websites I put all the web pages (php, html etc) in the root directory . I then have sub directories called lib (for javascript files), images (for image files), stylesheets (for stylesheets). Under the lib directory I have a directory called includes for php include files and a directory called classes for php class files.

    For larger websites I will have additional directories and sub-directories to suit.

  3. #3
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First of all I would like to ask you why not OOP and MVC? They make the (programming) life much much easier as far as I know. But if you are still go for this normal structural programming and want to manage the files, then see how I would go for:
    Document Root - all the PHP/HTML files that are accessed from URL (browser's address bar) i.e. index.php, about.php, etc.
    include - all the including files like header.php, footer.php, left.php (which are included in the main files index.php, about.php, contact.php)
    js - all the javascript files
    images - all the images
    css - all css files
    library - all the PHP files that are not directly accessed from browser but included instead i.e. functions.php. Also all the third party codes/classes i.e. fpdf, phpmailer, etc.
    library/classes - all the classes that you developed if you have any (just to segregate from other include files.

    I don't say best one but would cover and show the difference of the files
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  4. #4
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Raju Gautam View Post
    First of all I would like to ask you why not OOP and MVC? They make the (programming) life much much easier as far as I know.
    Because I have never been able to understand OOP and MVC to the point where I would feel comfortable building a real website using them. (Any idiot on the Internet can write OOP and MVC, but in my experience 95% of those people haven't a clue what they are doing... I choose to use a simpler, more traditional approach until I can do the newer methods the *correct* way...)


    But if you are still go for this normal structural programming and want to manage the files, then see how I would go for:
    Document Root - all the PHP/HTML files that are accessed from URL (browser's address bar) i.e. index.php, about.php, etc.
    include - all the including files like header.php, footer.php, left.php (which are included in the main files index.php, about.php, contact.php)
    js - all the javascript files
    images - all the images
    css - all css files
    library - all the PHP files that are not directly accessed from browser but included instead i.e. functions.php. Also all the third party codes/classes i.e. fpdf, phpmailer, etc.
    library/classes - all the classes that you developed if you have any (just to segregate from other include files.

    I don't say best one but would cover and show the difference of the files
    I am basically doing what you suggest now. If I add additional folders by "functional grouping" (e.g. myaccount, help, workshops, etc) am I helping or hurting things?

    It just seems like as my website grows, that if I have everything "that you can access from the URL" (as you say) I could still easily have dozens - if not hundreds - of files in my Document Root?!

    On a related note, what do mega-sites like CNN, USAToday, Yahoo, etc do to manage files? (They certainly would have to *expand* your approach?!)

    Do they put every webpage into a database?

    Thanks,


    Debbie

  5. #5
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    On a related note, what do mega-sites like CNN, USAToday, Yahoo, etc do to manage files? (They certainly would have to *expand* your approach?!)

    Do they put every webpage into a database?
    Though I cannot guarantee what they have done exactly because I have never been a developer of CNN, Yahoo, etc. yet :P But I am almost sure that they manage all the contents (or webpage in your word) in database. I don't think that there will be problem on keeping the more than 100 files in the document but if you are flexible calling them then that's indeed not a bad idea to categorize the files and keep them in different folders but it will increase the rules to be written for rewriting the URLs if you want later on.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


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
  •