Feature dcCMS - Gadreel/divconq GitHub Wiki
It is helpful to have an understanding of how dcUI works when reviewing dcCMS.
How the server selects files is relevant to the CMS feature. To make the example complete consider the following web configuration.
<Module Name="Web" RunClass="divconq.web.WebModule">
<Extension Name="dcf" RunClass="divconq.web.WebExtension">
<Package Id="zCustomPublic" />
<Package Id="dc/dcFilePublic" />
<Package Id="dcWeb" />
</Extension>
<Extension Name="dcm" RunClass="divconq.web.WebExtension" />
<!-- more -->
</Module>
And consider that a user is visiting the site www.filetransferconsulting.com
and requests the path /dcf/index.html
. The domain alias (internal to DivConq) for that domain name is filetransferconsulting
.
Given the above here are the search paths in the order that they will be searched until index.html is found.
- ./private/dcw/filetransferconsulting/phantom/www/dcf/index.html
- ./private/dcw/filetransferconsulting/static/www/dcf/index.html
- ./public/dcw/filetransferconsulting/phantom/www/dcf/index.html
- ./public/dcw/filetransferconsulting/static/www/dcf/index.html
- ./packages/zCustomPublic/www/dcf/index.html
- ./packages/dc/dcFilePublic/www/dcf/index.html
- ./packages/dcWeb/www/dcf/index.html
The final three paths are the easiest to explain. When searching for a file each package in the Extension
is checked in its www folder. We have three packages listed so there are three possible matches. The web server takes the first match though, and since the first - dcFilePublic
- does match the last two are skipped.
The first four are additional searches that would override the packages if set. A check is always done for static
folders within public
and private
. And this is where the CMS feature comes in. The DivConq CMS stores its user editable web pages on disk rather than in a database in the public
and static
folders. The CMS admin tool loads info from about the page from the file.
Page title, description, keywords, content, etc all come directly from the file.
TODO file example
Drafts are stored in phantom
folder. When an author is logged into the CMS tool they can choose Preview mode which will show any draft content for the entire site. So when CMS Preview is enabled there is an additional search in phantom
folders within public
and private
before checking static
.
Assuming preview mode is off, as it typically would be, the actual search done for index.html - before a match is made - is:
- ./private/dcw/filetransferconsulting/static/www/dcf/index.html
- ./public/dcw/filetransferconsulting/static/www/dcf/index.html
- ./packages/zCustomPublic/www/dcf/index.html
- ./packages/dc/dcFilePublic/www/dcf/index.html
Lets say there is a file /dcf/about.html
in the dcFilePublic package. However, it has been overridden in public. So the search path for about would be (until a match is made):
- ./private/dcw/filetransferconsulting/static/www/dcf/about.html
- ./public/dcw/filetransferconsulting/static/www/dcf/about.html
On the other hand lets say there was never an about in dcf. What if about.html is only in the CMS? When this is the case use the /dcm/
path for your file. So in this scenario the user loads /dcm/about.html
. Now looking back at the web server settings recall that dcm
is configured as thus:
<Extension Name="dcm" RunClass="divconq.web.WebExtension" />
There are no packages configured for dcm, so no packages will appear in the search path. The full search path for /dcm/about.html
is now:
- ./private/dcw/filetransferconsulting/phantom/www/dcm/about.html
- ./private/dcw/filetransferconsulting/static/www/dcm/about.html
- ./public/dcw/filetransferconsulting/phantom/www/dcm/about.html
- ./public/dcw/filetransferconsulting/static/www/dcm/about.html
However, if not in preview mode the search path really is:
- ./private/dcw/filetransferconsulting/static/www/dcm/about.html
- ./public/dcw/filetransferconsulting/static/www/dcm/about.html
And if private
files aren't being used (public only is recommended) the search path is really just:
- ./public/dcw/filetransferconsulting/static/www/dcm/about.html
Saving extra lookups and confusion for files served via dcm
.
Officially the editing of files is always done on the backend server such as dcFileServer or dcTaskServer. What about the gateway? The gateway has a copy of the website and an independent web server. So changes on backend would not automatically be seen by users of the gateway.
DivConq plans to support automatic file replication between servers. When this feature is ready then files updated in ./public/
on a backend server will replicate to other backend servers and to the gateway servers. [Side note - when this feature is ready then files updated in ./private/
on a backend server will replicate to other backend servers BUT not to the gateway servers.]
Until the replication feature is supported updates to any ./public/
file must be manually copied to the gateway in order for it to be visible to the public.
Files containing secure content should not be placed in ./public/
. Either place the secure content in a file in ./private/
or place the secure content in the database and use the Templates
feature to load the data when the web page loads. While the later is slower, it is the better approach for showing the correct content to the correct roles - admins can see data that users cannot - while still keeping the entire web interface available via the gateway.
<article id="main" data-cms-path="/dcw/Home.dcui.xml" data-cms-part="main-content" data-cms-locale="en" data-cms-authtag="Developer" data-cms-content="text">
Content
- text: html/md/bbedit content
- image: a single image (optional caption)
- list: rearrange order, edit list items, add list item based on template