[RESOLVED] Folder structures
Results 1 to 14 of 14

Thread: [RESOLVED] Folder structures

  1. #1
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    461

    resolved [RESOLVED] Folder structures

    I am almost 100% sure I'm over thinking this but I started to make something however I'm almost positive I'm over thinking it (not that I have ever done that before ) Basically I'm thinking the structure should roughly be:

    PHP Code:
    -Main folder 
    Index
    .php
    -Assets folder 
       
    -JS folder
       
    -CSS folder
       
    -Images folder 
    -Classes folder 
    -pages folder (main content will go here
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Fresh start
    Current date 14/10/17
    Finish date "should be" 14/04/18

    Vote on your preferred indentation method

  2. #2
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    14,856
    Where is your Tests directory?

    Assuming everything goes through the index.php file, you might want a .htaccess config to force that, with an exception for the Assets folder, whose contents you'll want to access directly, most likely. Here's what I used for my cwrblog code (in which I used essentially a MVC-style directory structure):
    Code:
    DirectoryIndex index.php
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule ^favicon static/favicon.ico
        RewriteRule !^static index.php
    </IfModule>
    ErrorDocument 404 /static/404.html
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    461
    Tests directory? erm it's ... on holiday (i'll add one)

    This is what I had done so far, going to look how you set yours up, some of it's a bit ummm but can but try

    https://github.com/cluelessphp/structure
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Fresh start
    Current date 14/10/17
    Finish date "should be" 14/04/18

    Vote on your preferred indentation method

  4. #4
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Contact Unit "Coping Mechanism"
    Posts
    22,519
    Just throwing this out there, but assets of different types can already be distinguished by their file extension, yes? Does putting them in separate directories as well add anything?
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  5. #5
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    461
    Quote Originally Posted by Weedpacket View Post
    Just throwing this out there, but assets of different types can already be distinguished by their file extension, yes? Does putting them in separate directories as well add anything?
    Mostly it was to try and keep it tidy

    After this disaster I'm trying to keep everything more organized

    https://github.com/cluelessphp/wot
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Fresh start
    Current date 14/10/17
    Finish date "should be" 14/04/18

    Vote on your preferred indentation method

  6. #6
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    14,856
    Quote Originally Posted by Weedpacket View Post
    Just throwing this out there, but assets of different types can already be distinguished by their file extension, yes? Does putting them in separate directories as well add anything?
    Functionally, no; but if you have more than a few files in each category, it's generally easier to find the file you want in your editor/ide if you can just go to the js|css|img|whatever directory. Now, if we used file prefixes instead of suffixes....
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  7. #7
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    8,506
    Quote Originally Posted by NogDog View Post
    Functionally, no; but if you have more than a few files in each category, it's generally easier to find the file you want in your editor/ide if you can just go to the js|css|img|whatever directory. Now, if we used file prefixes instead of suffixes....
    Yes, but perhaps he's talking about the "assets" directory, which seems superfluous; Why $root/assets/js or $root/assets/css when you could use $root/js or $root/css?
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  8. #8
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    14,856
    Quote Originally Posted by dalecosp View Post
    Yes, but perhaps he's talking about the "assets" directory, which seems superfluous; Why $root/assets/js or $root/assets/css when you could use $root/js or $root/css?
    Eh...I kind of like it, personally; sort of like a /lib/ directory for all your 3rd-party packages.

    Ultimately, as long as it's clear, consistent, and supports any auto-loading stuff you want to do...whatever.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  9. #9
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    461
    Quote Originally Posted by NogDog View Post
    Eh...I kind of like it, personally; sort of like a /lib/ directory for all your 3rd-party packages.

    Ultimately, as long as it's clear, consistent, and supports any auto-loading stuff you want to do...whatever.
    That was what I was thinking, originally I'd called it "thingys" but that seemed a little...let's go with vague
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Fresh start
    Current date 14/10/17
    Finish date "should be" 14/04/18

    Vote on your preferred indentation method

  10. #10
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    8,506
    Quote Originally Posted by NogDog View Post
    Eh...I kind of like it, personally; sort of like a /lib/ directory for all your 3rd-party packages.

    Ultimately, as long as it's clear, consistent, and supports any auto-loading stuff you want to do...whatever.
    I can understand it a little more if it's 3rd party. Of course, I prefer to write all that stuff myself if I'm concerned about security and the like, but then again you'll find plenty of other people's JS in my projects ... so ...
    Last edited by dalecosp; 10-11-2017 at 05:20 PM.
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  11. #11
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    14,856
    Besides, don't think of it as a directory, but as a file name prefix with a slash delimiter.

    Or maybe as a namespace?
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  12. #12
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    461
    Quote Originally Posted by dalecosp View Post
    I can understand it a little more if it's 3rd party. Of course, I prefer to write all that stuff myself if I'm concerned about security and the like, but then again you'll find plenty of other people's JS in my projects ... so ...
    Well the idea I have involves a lot of address, would you really want to sit and manually type in every address there is?
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Fresh start
    Current date 14/10/17
    Finish date "should be" 14/04/18

    Vote on your preferred indentation method

  13. #13
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    8,506
    Quote Originally Posted by cluelessPHP View Post
    Well the idea I have involves a lot of address, would you really want to sit and manually type in every address there is?
    Oh, I'd love to, but right now I'm really tied up typing up all the titles, prices, descriptions, etc. for the 150K products on our site. And after that I have to draw the pictures, so I'm busy at least until the week after I die ...
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  14. #14
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    461
    Quote Originally Posted by dalecosp View Post
    Oh, I'd love to, but right now I'm really tied up typing up all the titles, prices, descriptions, etc. for the 150K products on our site. And after that I have to draw the pictures, so I'm busy at least until the week after I die ...
    Looks like someone didn't read the small print of his contract, death is prohibited until project is complete
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Fresh start
    Current date 14/10/17
    Finish date "should be" 14/04/18

    Vote on your preferred indentation method

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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