There are several components to do what you might like.
Main idea is to organize code so that distribution can be automated without complications.
Part I - CMS-related code management - I keep my code in one place. I have a private offline repository of code, which consists of modded tags, new tags, functions, admin-panel customizations etc. Modifications, validators, shortcodes etc - all is kept in separate files and autoloaded from their subfolders and is stored in main folder '/couch/addons/community-mods'. Physically it is inside /couch/addons folder, so it is safe there. I
never modify couch native files, because it is not recommended practice and custom code should not get overwritten if couch is updated on github.

- folders.png (36.65 KiB) Viewed 3615 times
I also moved /couch/config.php and /couch/addons/kfunctions.php to the site's root for quick access - '_config.php' and '_kfunctions.php'. Couch doesn't overwrite them but still it helps. I also created symlinks to /couch/addons in '/mysnippets' folder which helps for faster access, because I work mostly with snippets. And I have /config-local, /config-server folders, as well as /htaccess-local, /htaccess-server folders because the settings are different between VPS and local PC.
Part II - I need to only update
embeddable snippets of code. See
http://docs.couchcms.com/miscellaneous/smart_embed.html I never touch main php files, which are dropped in site's root. 100% of my php template files contain the following structure -
- Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title="Index" clonable='1' nested_pages='0' gallery='0' dynamic_folders='1' order='0010' routable='0'>
<cms:smart_embed 'template_editables' />
<cms:smart_embed 'template_config' />
<cms:smart_embed 'template_routes' />
</cms:template><cms:ignore>
/*
Index..
*/
</cms:ignore>
<cms:set my_debug='0' />
<cms:smart_embed debug=my_debug 'html_afore' />
<!DOCTYPE html>
<html lang="<cms:show k_lang />">
<cms:smart_embed debug=my_debug 'html_headers' />
<body>
<cms:smart_embed debug=my_debug 'html_hero' />
<cms:smart_embed debug=my_debug 'html_master' />
<cms:smart_embed debug=my_debug 'html_trail' />
</body>
</html>
<?php COUCH::invoke(); ?>
<?php //COUCH::invoke( K_IGNORE_CONTEXT ); ?>
Snippets, especially
smartly-embedded snippets are the best way to maintain code in chunks, possibly updating it with
perfect precision, only those parts that need attention. (If site's footer for page-view is updated, I replace file on server 'html_trail/index-page.trail' (according to my naming structure) and that's it. Same reasoning applies to template editable fields and their configs, they are kept in snippets to the most comfotable work with code and with updates). Smart embed allows any extension, so when I work in code editor I can immediately see which file I need, editable fields are 'index.fields', home-view code is 'index-home.master', configuration of template and fields is 'index.config' etc.
Part III - is a more deeper level of code-chunking, aka
snippet inheritance via
cms:block-cms:extends tags, which enables us to avoid editing and overwritting any snippets, but just drop a new file that will be automatically picked as most relevant (similar to smart-embed tag, but works with smaller and granular pieces of code) -
viewtopic.php?f=5&t=10984 There are possibly other moments that I forgot to mention. All these work environment improvements were done incrementally over the 4 years span since OP. This process never stops. I am sure you probably have some more ideas and plans about managing websites from single place. We can discuss those as well. If this post is not what you wanted, PM me, I can help.
P.S. That repo mentioned is not online or on git, it is a bunch of zip files (I am not a github fan). For each new installation I take what I need and fking unzip them in one click. Every zip already contains the proper folder structure, so the pieces go like a lego. Today it looks like this (probably I should add a couple of files from this week's work).