Live CockpitCMS+Svelte Projects:
3. CockpitCMS Back-end Parts
- This is a system built on PHP, riot.js and the Lime PHP framework.
- CockpitCMS consists of modules and besides JSON API it also provides a PHP bootstrap that allows accessing or extending it.
- CSS is handled purely through UIKIT v2, apart from custom extensions.
Most Important Locations
All are in public/cockpit
| Location | Purpose |
|---|---|
| assets/app/css | Cockpit CSS + custom extensions via custom.scss, which is compiled indirectly to .css via style.less |
| assets/app/media/icons | Icons available in CockpitCMS as icons for structures or components. |
| assets/lib/font-awesome-field | Fully custom library for implementing fontawesome select field imported into components.js below. |
| config/* | Contains hidden configuration in yaml (quite poorly documented) for CMS and addons. There's also a folder containing all localizations of the admin interface to other languages. |
| addons | Addons are extensions, some (Layout-Components) quite heavily modified from their pre-installation state. |
| lib | Framework and libraries on which Cockpit is built. I've never changed anything here and probably won't, better not to touch. |
| modules | Individual types of data storage (structures, regions, forms) and their implementations. |
| modules/Collections | Structures - Occasional custom modification. |
| modules/Cockpit/components.js | riot.js implementation of every single field type from which components/structures can be composed. Very heavy custom modification (e.g. custom fontawesome and url fields) |
| storage | Main storage, flat-file databases, cache, upload location for all assets, don't touch directly, only through the CMS itself! |
Before Publishing
- Check the existence and validity of
.htaccessin important locations, especially that .sqlite is blocked inpublic/cockpitandpublic/api/privatehasdeny from all - Don't publish
.css.mapand.js.mapfiles
ftpsync.js exclude filters may not be configured correctly.
Connection with public/index.php
In public/index.php, the CockpitCMS bootstrap is imported and the cockpitql addon is used to check if a slug exists in the page list.
The CockpitQL addon was additionally extended in the file CockpitQL/Types/FieldType.php with case:"moderation", so that slugs can be filtered based on whether they were published by the Moderation addon. This ensures that crawlers get a 404 on unpublished pages.
WEDOS / localhost Live Preview
![]() |
|---|
| The address needs to be set correctly in the structure settings. |
In Preview.svelte, allowed sources are set to:
And the allowed event is set to: cockpit:collections.preview
Unsupported .htaccess Values for WEDOS
Surprisingly, from the entire complex .htaccess in public/cockpit, only one thing doesn't work, which causes 500 Internal Server Error:
Options -MultiViews
The error occurs even if the option is in the condition <IfModule mod_negotiation.c>, which is missing by default. The option is therefore commented out.
Modification of bootstrap.php Paths for WEDOS and path_check.php
In the bootstrap.php file, local paths for php are defined based on COCKPIT_DOCS_ROOT and subsequently, paths in URL addresses stored in COCKPIT_BASE_URL are derived from it by difference with COCKPIT_DIR.
For debugging paths, it's useful to use path_check.php.
Correct default display on localhost:
COCKPIT_DIR: C:/Websites/strukshow.com v2 (svelte)/public/cockpit
WEDOS_DOCS_ROOT: C:/Websites/strukshow.com v2 (svelte)/public
COCKPIT_DOCS_ROOT: C:/Websites/strukshow.com v2 (svelte)/public
COCKPIT_DOCS_ROOT_PREV: C:/Websites/strukshow.com v2 (svelte)/public
COCKPIT_BASE: cockpit
COCKPIT_BASE_URL: /cockpit
COCKPIT_BASE_ROUTE: /cockpit
Wrong default display on WEDOS:
COCKPIT_DIR: /data/web/virtuals/232327/virtual/www/domains/dev.strukshow.com/cockpit
WEDOS_DOCS_ROOT: /data/web/virtuals/232327/virtual/www/domains/dev.strukshow.com
COCKPIT_DOCS_ROOT: /data/web/virtuals/232327/virtual/www
COCKPIT_DOCS_ROOT_PREV: /data/web/virtuals/232327/virtual/www
COCKPIT_BASE: domains/dev.strukshow.com/cockpit
COCKPIT_BASE_URL: /domains/dev.strukshow.com/cockpit
COCKPIT_BASE_ROUTE: /domains/dev.strukshow.com/cockpit
Due to incorrectly defined $_SYSTEM["DOCUMENT_ROOT"], individual addresses have additionally inserted completely unnecessary domain data (surprisingly the addresses still work). Therefore, $WEDOS_DOCS_ROOT was added and the calculation of $COCKPIT_DOCS_ROOT was replaced:
// Default implementation (doesn't work properly on WEDOS)
$COCKPIT_DOCS_ROOT = str_replace(DIRECTORY_SEPARATOR, '/', isset($_SERVER['DOCUMENT_ROOT']) ? realpath($_SERVER['DOCUMENT_ROOT']) : dirname(__DIR__));
// WEDOS implementation (works on localhost as well)
$WEDOS_DOCS_ROOT = str_replace("/cockpit","",$COCKPIT_DIR);
$COCKPIT_DOCS_ROOT = str_replace(DIRECTORY_SEPARATOR, '/', isset($WEDOS_DOCS_ROOT) ? realpath($WEDOS_DOCS_ROOT) : dirname(__DIR__));
WEDOS after modification (localhost remained the same as before):
COCKPIT_DIR: /data/web/virtuals/232327/virtual/www/domains/dev.strukshow.com/cockpit
WEDOS_DOCS_ROOT: /data/web/virtuals/232327/virtual/www/domains/dev.strukshow.com
COCKPIT_DOCS_ROOT: /data/web/virtuals/232327/virtual/www/domains/dev.strukshow.com
COCKPIT_DOCS_ROOT_PREV: /data/web/virtuals/232327/virtual/www/domains/dev.strukshow.com
COCKPIT_BASE: cockpit
COCKPIT_BASE_URL: /cockpit
COCKPIT_BASE_ROUTE: /cockpit
Previous: 2. CockpitCMS Administration
Next: 4. Svelte Files Explainer
