Anyone who starts to understand Evolution will come across new terms. Here we will note small points that you can periodically spy on.
Template - Contains the general layout of the page with structure and design. It also defines where to display dynamic content. You can choose your own template for each document.
Parameters (TV) - Additional parameters that are connected to the template. Parameters can be of different types (text, link, file, date, number, etc.). For more details on types, see the following articles.
Chunk - Chunk is a small template that can be used both simply for displaying some content (phone on all pages), and for processing (template of the sent eForm letter, template of the directory displayed by Ditto, etc.). Thus, the kind (presentation) of information is separated from the place of processing and is easily controlled.
Snippet - Snippet is a code for processing information. The received information is analyzed (for example, the user's message) and the result is provided (for example, the message is sent by mail, and the user is shown a message about the result). Snippets form menus (Wayfinder), output lists of articles with pagination (Ditto), build forms (eForm). Chunks are used for withdrawal.
Plugin - A plugin is a code that runs when an event occurs. For example, it highlights search words (Search Highlighting) when navigating from a search page. There are many events and their consideration is worth a separate article.
Special tags are used to display dynamic data.
[\*TVname\*] - prints the value of the parameter in the document.
{{ChunkName}} - returns the contents of the chunk.
[[SnippetName]] - returns the result of the snippet.
You can pass additional parameters to the snippet, listing them when called. Suppose, if we want to get the id of the current document and process it in a snippet, then the call may look like this:
[[snippetname?docId=`[+id+]`]]
[+VariableName+] - placeholder - found in chunks that are used to process the results of snippets. After processing, values are inserted instead. In the example above, you can see how we have substituted the system placeholder [+id+] in the docId parameter for the snippet, in which the id of the current document will be. You can create placeholders yourself.
Nuances
There are actually two options for calling a snippet:
Where to use
Everything is very harmoniously used with each other. In templates, you can use TV parameters, snippets and chunks. In chunks, you can call snippets, TV parameters and other chunks. In snippets, you can call anything at all, but through PHP. Ultimately, you will receive the final result of processing all snippets/chunks/TV parameters.
<!DOCTYPE html>
<html lang="[(lang_code)]">
{{head_tags}}
<body>
[*content*]
</body>
</html>
where head_tags is a chunk with the following content:
<head>
<base href="[(site_url)]" />
<meta charset="[(modx_charset)]" />
<title>[*pagetitle*] / [(site_name)]</title>
</head>
And in the field [*content*] will be displayed the content of the page, set from the admin panel. Everything else is based on this information.