Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
Hi everyone. A collection of every other script available for Couch could perfectly be packed into a custom theme. This small idea came to mind and it seems comfortable to launch a project faster. That's based on presence of kfunctions.php in theme folder. Perhaps someone is already using themes this way? If so, let's discuss our experience.

Here's a development of idea for you to try. Theme structure with autoloading goes like Apache config, where mods can be drag-and-dropped from mods*-available folder to mods*-enabled. All possible scripts are stored in *-available and when uploading to client you simply delete *-available folders leaving only *-enabled. This boosts speed by not loading everything and keeps only required tweaks/tags/etc on production for client to see. This way usual addon location - /couch/addons/ - becomes a storage for mostly core addons by Couch itself. In example pic below a new site-wide CMS variable is demonstated to be placed in the vars-enabled folder. As each and every tweak is already separated dropping folders is the easiest way to enable/disable tweak (with autloading only from *-enabled folders).

Screenshot-2023-10-28-151353.676.png
Screenshot-2023-10-28-151353.676.png (19.14 KiB) Viewed 3522 times


A plus is also in theme modding, with various mods already integrated into a theme, giving it premium Couch experience, example: gallery template drag-drop image reordering, multi-delete of fields, character counter for textarea fields, extra toolbar buttons etc. [it's in theme snippets that are not demonstrated in screenshot above] I am not discussing custom icons or designs, because that's what is unique and tailored, but very easy to include as themes are actually planned for this.

Every serious CMS coder on Couch already has a collection of fav addons and tweaks, I presume. Theme is a way to keep this organized. I myself tried a github repository for stuff, but that's not easy to maintain and not practical for quick starting/inheriting a project (although I got a few skills from that experience). So, with everything packed and integrated into a custom theme it's farily easy to copy among the sites. If a site already has a custom theme, that's not a big deal to merge differences among theme .html snippets once.

Reorganizing a bloated kfunctions.php file and addons folder into a perfectly manageable theme which is instantly connected with a site is a dream come true, very neat and professional. I will gladly help with custom themes and tweaks.
This theme idea grows on me further :) I am attaching my autoloader for anyone to play. Update: removing obsolete version, as the improved one (additional filters for absolute efficiency) is in the Ryazania theme - link viewtopic.php?f=2&t=13475

Theme with integrated tweaks could be attached later if there is any interest from you guys. In autoloader can enable logging to see what happens (switch line17 and line18 in autoload.php with $dump_log variable)

For example, I have a phpinfo(); script that sometimes is needed to see modules in apache or details about PHP version.

Screenshot-2023-10-29-214010.996.png
Screenshot-2023-10-29-214010.996.png (46.17 KiB) Viewed 3501 times


My steps would be to (1) drag a folder with phpinfo code from /scripts-available/ to /scripts-enabled/ and (2) open any website page, which is now showing only phpinfo() output. Once I have checked said info I drag the folder back to /scripts-available/ and it is not active anymore. This allows us to write code once then connect it when needed. Same with tags, vars, addons, tweaks etc. Test a shortcode? No need to copy paste code to kfunctions, just move from one folder to another, use it, then when not needed move back to 'repository' /shortcodes-available/. The only thing to do now is to fill the folders with separated tweaks - this is something we can already do.
2 posts Page 1 of 1
cron