> For the complete documentation index, see [llms.txt](https://docs.navigaglobal.com/everyware/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.navigaglobal.com/everyware/starter-kit-packages/everyware-twig/development/functions/render_partial.md).

# render\_partial

The *render\_partial* function will render a template outside of the current context.

Consider the following template:

```php
{# @mynamespace/article.twig #}

<article>
    <a href="{{ link }}">
        <header>
            <h1>{{ title }}</h1>
        </header>
        <div class="body">{{ text }}</div>
    </a>
</article>
```

This would work fine if you normally use this template directly from php like so:

```php
View::render('@mynamespace/article', $article->toArray());
```

Now imagine that you want to render this template inside a loop:

```php
{% for article in articles %}
    {% include '@mynamespace/article.twig' %}
{% endfor %}
```

The variables you would want to use in the template would now be bound to "article" and `link` would in this case be located on `article.link`.

But the *render\_partial* function will, behind the scenes, use `View::render()` to render the template:

```php
{% for article in articles %}
    {{ render_partial('@mynamespace/article', article.toArray())

    {# Or if "article" is an array #}

    {{ render_partial('@mynamespace/article', article)
{% endfor %}

{# The template will be render outside of the scope as if "article" was injected as the template data #}
```

This would be equivalent to:

```php
View::render('@mynamespace/article', $article->toArray());
```
