Jump to content

Wireframe Renderer Latte


teppo
 Share

Recommended Posts

Following recent discussion about the Latte templating language, I figured I'd give it a try too and put together a Latte renderer for Wireframe:

In case anyone wants to try this, it would be interesting to hear your thoughts. I'm honestly not sure if I'll be using it much myself, and I built the module without any real Latte experience under my belt, so it's possible that it does things in surprising ways. Let me know if you run into any issues ?

Syntax wise, Latte doesn't differ much from regular PHP templates — you just write your PHP code within {curly brackets}, and it gets automatically escaped (with what they call context-aware escaping). They have this thing called n:attributes though, which is actually quite nice shortcut, especially if you happen to dislike if..else and foreach:

<ul n:if="$page->numChildren(true)" class="menu">
    <li n:foreach="$page->children as $child">
        <a n:tag-if="!$child->hide_from_menu" href="{$child->url}">
            {$item->title}
        </a>
    </li>
</ul>

You can read more about Latte from https://latte.nette.org/en/.

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

  • Like 7
Link to comment
Share on other sites

  • 1 year later...

Hi,

I wanted to give Wireframe a shot with the Latte renderer but can't get it to work. The layouts/default.latte template does'nt seem to load the views/home/default.latte

I'm using the ProcessWire 3.0.228 with PHP 8.2. and both Wireframe and WireframeRendererLatte have been installed via ProcessWire (not with Composer).

What am i doing wrong ?

Capture d’écran 2023-09-28 à 10.17.44.jpg

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...