# Função de inclusão

A função

**include** retorna o conteúdo renderizado de um modelo:

{{ include('template.html') }}

{{ include(some\_var) }}

\
Os modelos incluídos têm acesso às variáveis ​​do contexto ativo.

\
Se você estiver usando o carregador do sistema de arquivos, os modelos são procurados nos caminhos por ele definidos.

\
O contexto é passado por padrão para o modelo, mas você também pode passar variáveis ​​adicionais:

{# template.html will have access to the variables from the current context and the additional ones provided #}

{{ include('template.html', {foo: 'bar'}) }}

\
Você pode desativar o acesso ao contexto configurando with\_context para false:

{# only the foo variable will be accessible #}\
{{ include('template.html', {foo: 'bar'}, with\_context = false) }}

{# no variables will be accessible #}\
{{ include('template.html', with\_context = false) }}

\
E se a expressão for avaliada como uma \Twig\Template ou uma \Twig\TemplateWrapper instância, o Twig a usará diretamente:

// {{ include(template) }}

\
$template = $twig->load('some\_template.twig');

\
$twig->display('template.twig', \['template' => $template]);

&#x20;Quando você definir o sinalizador **ignore\_missing** , o Twig retornará uma string vazia se o modelo não existir:

{{ include('sidebar.html', ignore\_missing = true) }}

\
Você também pode fornecer uma lista de modelos cuja existência é verificada antes da inclusão. O primeiro modelo que existe será renderizado:

{{ include(\['page\_detailed.html', 'page.html']) }}

\
Se

**ignore\_missing** estiver definido, ele não renderá nada se nenhum dos modelos existir, caso contrário, ele lançará uma exceção.

\
Ao incluir um modelo criado por um usuário final, você deve considerar colocá-lo em **sandbox**:

{{ include('page.html', sandboxed = true) }}

### **Argumentos**

* template: O modelo a ser renderizado
* variables: As variáveis ​​a serem passadas para o modelo
* with\_context: Se deve passar as variáveis ​​de contexto atuais ou não
* ignore\_missing: Se deve ignorar os modelos ausentes ou não
* sandboxed: Se deve ser feito o sandbox do modelo ou não

&#x20;Ficou com alguma dúvida? Entre em contato através do nosso chat online.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ajuda.iset.com.br/inicio/minha-loja/personalizacao/personalizacao-avancada-cms/funcao-de-inclusao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
