include

Table of contents

Inserts a snippet of code from another file.

{% include "includes/form_field", field_type: field_line.type %}
Input

Note that you don’t have to include the file’s extension .plate. The theme file’s path is includes/form_field.plate. You can also pass named variables to the included file by adding key: value arguments, each separated by a comma. In the example a variable field_type is available in the included theme file.

You can also pass a Plate object instead of a string for a location.

{% include field %}
Input

Assuming that the variable field is an object with the content type ‘field_line(s)’, this is the equivalent of:

{% include "elements/field_lines/field_line", field_line: field_line %}

content_for_head

Plate uses a set of CSS and JS to make the nested layout structure and inline editing working. These assets are loaded by putting {% include "content_for_head" %} in the <head> of your page.

recaptcha_scripts

If you are using reCaptcha for your forms, you need to add {% include "recaptcha_scripts" %} somewhere on the page that has the form on it. The form will not be submitted if the scripts are not included on the page! You will receive the following JS error: executeRecaptcha is not defined if it's not included.

Need help?

Do you have any question which is not answered in this knowledge base? Contact us. We are here to help you.