This repository is snippet template. Use it when you create a new snippet repository. Here should be placed a description of the plugin. All texts below are examples, replace them with real information.
- PHP >= 5.6
- (MODX)EvolutionCMS >= 1.1
- (MODX)EvolutionCMS.libraries.ddTools >= 0.59
Just run the following PHP code in your sources or Console:
// Include (MODX)EvolutionCMS.libraries.ddInstaller
require_once(
$modx->getConfig('base_path')
. 'assets/libs/ddInstaller/require.php'
);
// Install (MODX)EvolutionCMS.snippets.ddStartSnippet
\DDInstaller::install([
'url' => 'https://github.com/DivanDesign/EvolutionCMS.snippets.ddStartSnippet',
'type' => 'snippet',
]);
- If
ddStartSnippet
is not exist on your site,ddInstaller
will just install it. - If
ddStartSnippet
is already exist on your site,ddInstaller
will check it version and update it if needed.
- Snippet name:
ddStartSnippet
. - Description:
<b>1.0</b> Snippet description.
. - Category:
Core
. - Parse DocBlock:
no
. - Snippet code (php): Insert content of the
ddStartSnippet_snippet.php
file from the archive.
- Create a new folder
assets/snippets/ddStartSnippet/
. - Extract the archive to the folder (except
ddStartSnippet_snippet.php
).
-
someParam1
- Description: Parameter description.
- Valid values:
string
integer
- Required
-
someParam2
- Description: Parameter description.
- Valid values:
0
1
- Default value: —
-
outputterParams
- Description: Parameters to be passed to the specified outputter.
- Valid values:
stringJsonObject
— as JSONstringHjsonObject
— as HJSONstringQueryFormatted
— as Query string- It can also be set as a native PHP object or array (e. g. for calls through
\DDTools\Snippet::runSnippet
or$modx->runSnippet
):arrayAssociative
object
- Default value: —
-
outputterParams->tpl
- Description: Some template.
- Available placeholders:
[+somePlaceholder1+]
— placeholder 1 description[+somePlaceholder2+]
— placeholder 2 description
- Available placeholders:
- Valid values:
stringChunkName
string
— use inline templates starting with@CODE:
- Required
- Description: Some template.
-
outputterParams->placeholders
- Description: Additional data has to be passed into the
outputterParams->tpl
.- Nested objects and arrays are supported too:
{"someOne": "1", "someTwo": "test" }
=>[+someOne+], [+someTwo+]
.{"some": {"a": "one", "b": "two"} }
=>[+some.a+]
,[+some.b+]
.{"some": ["one", "two"] }
=>[+some.0+]
,[+some.1+]
.
- Nested objects and arrays are supported too:
- Valid values:
object
- Default value: —
- Description: Additional data has to be passed into the
All examples are written using HJSON, but if you want you can use vanilla JSON instead.
Some example description.
// Some exmaple code
// Include (MODX)EvolutionCMS.libraries.ddTools
require_once(
$modx->getConfig('base_path')
. 'assets/libs/ddTools/modx.ddtools.class.php'
);
// Run (MODX)EvolutionCMS.snippets.ddStartSnippet
\DDTools\Snippet::runSnippet([
'name' => 'ddStartSnippet',
'params' => [
'someParam1' => 'Some param value',
],
]);