Jump to content

Wireframe Renderer Twig


teppo
 Share

Recommended Posts

The Twig renderer for Wireframe has been around a while already, it just didn't have a support forum thread of its own, so here we go. This optional add-on module lets one author layouts, views, partials, and component views using Twig instead of PHP. By design you can have view files that are either Twig or PHP — with this module enabled Wireframe will initially look for a .twig file, but if that doesn't exist, it'll fall back to a regular .php file instead.

Here's a small sample of what Twig looks like:

{% if page.numChildren(true) %}
    <ul class="menu">
        {% for child in page.children %}
            <li>
                <a href="{{ child.url }}">
                    {{ child.title }}
                </a>
            </li>
        {% endfor %}
        </ul>
{% endif %}

You can read more about Twig from https://twig.symfony.com/doc/. Twig syntax in specific is covered in Twig for Template Designers.

For more details about Wireframe renderers and how they are enabled and used, check out https://wireframe-framework.com/docs/view/renderers/.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...