Changing the default folder structure of concrete5
PermalinkI've searched for this in the forum but haven't found a good answer.
I would prefer a slightly different folder structure for concrete5. Instead of:
/blocks
/concrete
/config
/controllers
...
/packages
...I would rather have:
/app
-> /blocks
-> /controllers
-> ...other app-specific folders
/config
/concrete
/packages
Is this possible without core concrete5 changes?
Thanks for your response!
After looking into concrete's dispatcher extensively, I did get concrete5 working with that folder structure by adding in the following lines into index.php in the root folder:
It also looks like I need to do something with DIR_FILES_UPLOADED. I'll play around with that and see what that does.
Concrete is still uploading files to the /app/files folder instead of /files. Anyone know what constant to change to have concrete upload to the /files folder? Or is it due to my DIR_BASE constant being set to /app?
define('DIR_FILES_UPLOADED_STANDARD', DIR_BASE . '/files'); define('DIR_FILES_TRASH_STANDARD', DIR_BASE . '/files/trash'); define('REL_DIR_FILES_UPLOADED', DIR_REL . '/files'); if (!defined('DIR_FILES_BACKUPS')) { define('DIR_FILES_BACKUPS', DIR_BASE . '/files/backups'); } define('REL_DIR_FILES_UPLOADED_THUMBNAILS', DIR_REL . '/files/thumbnails'); define('REL_DIR_FILES_UPLOADED_THUMBNAILS_LEVEL2', DIR_REL . '/files/thumbnails/level2'); define('REL_DIR_FILES_UPLOADED_THUMBNAILS_LEVEL3', DIR_REL . '/files/thumbnails/level3'); define('REL_DIR_FILES_CACHE', REL_DIR_FILES_UPLOADED . '/cache'); #Cache if (!defined('DIR_FILES_CACHE')) { define('DIR_FILES_CACHE', DIR_BASE . '/files/cache'); } # Sessions/TMP directories
Just edit your index.php in your root folder. Modify as you wish.
One problem will come if you have strict error reporting on. Some of these constants get defined again later and you'll get a notice about that. The constants WILL NOT be overwritten, however, so you're good to go.
define('DIR_ROOT', dirname(__FILE__)); define('DIR_BASE', DIR_ROOT . "/app"); define('DIR_CONFIG_SITE', DIR_ROOT . "/config"); define("DIR_FILES_UPLOADED", DIR_ROOT . "/files"); define("DIR_FILES_UPLOADED_STANDARD", DIR_ROOT . "/files"); define('DIR_FILES_TRASH_STANDARD', DIR_FILES_UPLOADED_STANDARD . '/trash'); define("DIR_FILES_BACKUPS", DIR_FILES_UPLOADED . "/backups"); define("DIR_FILES_CACHE", DIR_FILES_UPLOADED . "/cache"); require('concrete/dispatcher.php');
http://github.com/concrete5
Dogma following in the world of CMS's usually leads to massive headache's.
Thanks for the suggestion!
However, as @mkly pointed at, concrete5 already assumes a lot of the folders to be in the main root folder, so I'm sure you need to worry about a lot of things when testing this.
How I'd like things to be:
/app/ <-- App-specific folder & overrides
/assets/ <-- Static assets (could override the core folder's assets if found any)
/concrete/ <-- Core
/files/ <-- Files
And in that structure the /app/ folder would actually contain a lot of what the root folder now contains (the folders you don't see in the list above).
One main point also here is that I'd really like the static assets to be included in one single folder, as they now are separate folders:
/css/
/js/
/images/
So, I already prefer a bit different kind of structure that you do... :) Can we ever find a perfect solution that everyone would be pleased with? Probably not, but it would be great if these could be easily configurable, though.
I would also like the /config/ folder to be part of the app folder, so that it would be /app/config/ because config is usually app-specific.
Antti
Maybe you can do it with symlinks or something, but again I think that might end up being really messy.
Is there any particular reason you're wanting it this way?