Download the PHP package dd/evolutioncms-snippets-ddgetchunk without Composer
On this page you can find all versions of the php package dd/evolutioncms-snippets-ddgetchunk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download dd/evolutioncms-snippets-ddgetchunk
More information about dd/evolutioncms-snippets-ddgetchunk
Files in dd/evolutioncms-snippets-ddgetchunk
Download dd/evolutioncms-snippets-ddgetchunk
More information about dd/evolutioncms-snippets-ddgetchunk
Files in dd/evolutioncms-snippets-ddgetchunk
Vendor dd
Package evolutioncms-snippets-ddgetchunk
Short Description Snippet gets the chunk contents by its name. For example, it useful to get chunks inside JS code.
License
Homepage https://code.divandesign.ru/modx/ddgetchunk
Package evolutioncms-snippets-ddgetchunk
Short Description Snippet gets the chunk contents by its name. For example, it useful to get chunks inside JS code.
License
Homepage https://code.divandesign.ru/modx/ddgetchunk
Please rate this library. Is it a good library?
Informations about the package evolutioncms-snippets-ddgetchunk
(MODX)EvolutionCMS.snippets.ddGetChunk
Snippet gets the chunk contents by its name. For example, it useful to get chunks inside JS code.
Also it can:
- Pass additional data to chunk for parsing.
- Escape special chars for JS.
- Remove empty placeholders.
Requires
- PHP >= 5.6
- (MODX)EvolutionCMS >= 1.1
- (MODX)EvolutionCMS.libraries.ddTools >= 0.60
Installation
Using (MODX)EvolutionCMS.libraries.ddInstaller
Just run the following PHP code in your sources or Console:
- If
ddGetChunk
is not exist on your site,ddInstaller
will just install it. - If
ddGetChunk
is already exist on your site,ddInstaller
will check it version and update it if needed.
Manually
1. Elements → Snippets: Create a new snippet with the following data
- Snippet name:
ddGetChunk
. - Description:
<b>2.4</b> Snippet gets the chunk contents by its name. For example, it useful to get chunks inside JS code.
. - Category:
Core
. - Parse DocBlock:
no
. - Snippet code (php): Insert content of the
ddGetChunk_snippet.php
file from the archive.
2. Elements → Manage Files
- Create a new folder
assets/snippets/ddGetChunk/
. - Extract the archive to the folder (except
ddGetChunk_snippet.php
).
Parameters description
-
name
- Desctription: Chunk name or code via
@CODE:
prefix. - Valid values:
stringChunkName
string
— use inline templates starting with@CODE:
- Required
- Desctription: Chunk name or code via
-
placeholders
- Desctription:
Additional data has to be passed into the chunk.
Arrays are supported too:some[a]=one&some[b]=two
=>[+some.a+]
,[+some.b+]
;some[]=one&some[]=two
=>[+some.0+]
,[some.1]
. - Valid values:
stringJsonObject
— as JSONstringHjsonObject
— as HJSONstringQueryFormatted
— as Query string- It can also be set as native PHP object or array (e. g. for calls through
\DDTools\Snippet::runSnippet
or$modx->runSnippet
):arrayAssociative
object
- Default value: —
- Desctription:
Additional data has to be passed into the chunk.
-
removeEmptyPlaceholders
- Desctription: Placeholders which have not values to be replaced by will be deleted from parsed chunk if the parameter equals 1.
- Valid values:
0
1
- Default value:
0
escapeResultForJS
- Desctription: Escaping special chars for JS.
- Valid values:
0
1
- Default value:
0
Examples
All examples are written using HJSON for the placeholders
parameter, but if you want you can use vanilla JSON instead.
Get content of the form into JS code
Get chunk with Ditto and send necessary additional data into it
Code of someChunk
:
Run the snippet through \DDTools\Snippet::runSnippet
without DB and eval
Links
All versions of evolutioncms-snippets-ddgetchunk with dependencies
PHP Build Version
Package Version
The package dd/evolutioncms-snippets-ddgetchunk contains the following files
Loading the files please wait ....