The bulk of configuration required is performed within config.js
or config.php
.
When running the application in server+client mode, configuration should be done
within the PHP file, which will be used to dynamically generate the client config
when viewing the page.
This is the recommended mode as it preserves support for crawlers and bots.
When running server+client mode, only config.php is required.
When running the application in client-only mode, configuration should be done
within the config.js
file, then load that file in your index.html.
Set this to the host of the site, this is used to generate URLs for the site.
'host' => 'https://localhost'
Set this to the web path to use for the URL, for example, if your site is located in https://domain.tld/cms/ your webpath should be '/cms/' NOTE, a trailing slash is REQUIRED.
'webpath' => '/'
The URL that will be the default view that will initially load
/posts.html
/pages/home.html
'defaultView' => 'posts'
Set the theme to use for the site, this is the name of the directory within the themes
directory.
'theme' => 'default'
Set to true to enable debug logging, (will enable logging events to the console)
'debug' => false
Set the email configuration for the site, this is used for sending emails from the site.
If your site does not send emails, you can leave this blank.
Syntax of the DNS must be: smtp://username:password@host
'email' => [
'from' => 'contact@yourdomain.tld',
'fromName' => 'Your Name',
'dsn' => 'smtp://contact@yourdomain.tld:password@mail.yourdomain.tld',
],
Set the forms configuration for the site, this is used for processing forms on the site.
The actions
key in each form configuration is utilized by the backend
and never transmitted to the client, but field definitions are shared between
server and client configuration.
'forms' => [
'contact' => [
'fields' => [
'name' => [
'type' => 'text',
'required' => true,
],
'email' => [
'type' => 'email',
'required' => true,
],
'message' => [
'type' => 'textarea',
'required' => true,
],
],
'actions' => [
'email' => [
'to' => 'you@yourdomain.com',
],
],
],
],
In this example, a form named contact
is defined
with the fields name
, email
, and message
with an action to email the form data.
All field properties (shared with client):
type
-- The type of field, can be text
, email
, textarea
required
-- Set to true if the field is requiredlabel
-- The label to display for the fieldplaceholder
-- The placeholder text for the fieldSupported actions (only used on server):
email
-- Send an email with the form datatest
-- Test handler to return the form data as a JSON objectEmail options:
to
-- The email address to send the form data tosubject
-- The subject of the emailtemplate
-- The template to use for the emailIf a template is requested, it uses layouts/email-{templatename}.tpl
to render the data.
Else, (or if the template is not found) it will render the data as plain text.
Test options:
No options; just useful for debugging