
Originally Posted by
Andres Vaquero
So here I've been for a while giving shape to my first medium scale CMS and one of the things I deem very important now is to find a consistent structure for my directories as I see myself relocating files quite often.
I often find myself doing that when building a type of application which is new to me. If you become fixated on certain structures you lose out on a part of your application's evolution. Sometimes a change in the middle of development is a good thing - and its also a test for how well you've been coding. If your module files are dependent on the file-system layout (e.g. hardcoding paths), you're going to have a bit of a nightmare to do any rearrangements - but if you've made a library to handle all the file interactions (includes etc) it'd take no time at all.
Of course, you don't want to be making large changes for little/no benefit. Make informed changes based on problems you come across.

Originally Posted by
Andres Vaquero
Doing research in this matter I read that in order to enhance security all of the non-public files (application files) should reside outside of the root folder of the website (i.e. outside the public_html folder). This is what I am currently doing however this approach also makes it less practical for organization because i.e. any public files (js,css...) belonging to a particular module cannot be placed in the module folder. I have to create another folder that resides inside the public directory to host these files, which I don't like. I have not seen any CMS yet that has its application files outside the public folder. I wonder why that is. Any thoughts on this?
Why not use a mod-rewrite?
Something like:
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(images|scripts|styles)/([a-zA-Z0-9-]+)/(.*)$ ../modules/$2/$1/$3
Which should take an url like styles/yourModule/main.css to ../modules/yourModule/styles/main.css - unless styles/yourModule/main.css actually exists.

Originally Posted by
Andres Vaquero
I find myself now wanting to put all application core inside a folder called admin in the public directory just for ease of organization. What do you think about this? Well what are your thoughts generally on CMS directory structure and code organization? Know of any enlightening resources?
My personal opinion is that this would be about as acceptable as putting all your modules inside an images folder, or a sock in your cup of coffee. It just doesn't make sense
Bookmarks