In the 25 Days of omg.lol there was a “feature” called “advanced variables” and I was wondering if that was still a thing? if it got replaced with something else? or if it became deprecated or otherwise changed, such as a rename.
I’m looking to do some light templating, or partials, where I can pass some params in my post/page metadata and then place the “advanced variable” or partial in a higher up template.
The example I am looking to do:
- set some links or other resources in a post metadata, similar to tags or even how navigation works, comma separated
- then in the page template that uses that content, I can display it somewhere
Ideally this partial could be put into config and used where you want to, whether it be post or page.
Maybe I’m off here and this is a new ask. Let me know either way, thanks!
Unless I broke something at some point, these should still work — as described on 25 Days of omg.lol · Day 19. It’s really just a way to pass a kind of argument or parameter to a small templated snippet, more or less.
Recently @pimoore suggested that I look into implementing Mustache, and while I still haven’t had a chance to learn more about what it is and how it works (let alone start on any kind of implementation), I wonder if that might wind up being a better and more consistent approach to doing more advanced templating stuff. Any thoughts on that?
Okay, cool, I haven’t tried it yet but was looking to see if anything was included about it in the recent documentation work, but didn’t try too hard to find it. I’ll see what I come up with.
As for Mustache, I have worked with it quite a bit. It isn’t as advanced as something like Twig, but for light templating it might work for weblog, giving people stuff like looping and a little logic. I think I most used it when I worked with that version of Pattern Lab. I spent many years in Pattern Lab, but probably mostly with Twig + Drupal integration.
@anniegreens @adam Agreed about Mustache, it seems like a happy medium — to me at least — between having no logic whatsoever, and something like Hugo’s Go templates which are downright obtuse and horrible IMO. Not familiar with Twig to comment on it, but anything that’s accessible without being overly confusing would be a win, I think.
I guess my only concern with Mustache is the PHP version. The last time I worked in it, there was a move to not develop it much anymore IIRC. This was with Pattern Lab in the middle of deciding how it was going to handle “engines” and it went the Node route at that time. It is possible since then (this was 3+ years ago) it has picked up again, but I believe development had stalled, perhaps even maintenance, I guess that is something to consider or look into.
If you’re running it with PHP you’re better off with Twig. You get a lot from integrating Twig into a PHP project, along with some Symfony goodies. But it isn’t for everyone and I don’t think Twig would suite everyone using weblog. Sorry if I confused things.
@anniegreens @adam Not a good idea getting tied into something that’s unsupported. I’d also have the same concerns as you that Twig would be technically out of reach for some people — even I know nothing about it .