A Follow-Up to PHP Templating

Publikováno: 28.2.2020

Not long ago, I posted about PHP templating in just PHP (which is basically HEREDOC syntax). I'm literally using that technique for some super basic templating I needed to do on this very WordPress site. The main pushback was that this kind of thing can be an XSS vulnerability. In my case, it's not, because I'm not using it for anything other than an abstraction convenience for my own hand-written strings.

Since then, we've had a couple of good articles … Read article

The post A Follow-Up to PHP Templating appeared first on CSS-Tricks.

Celý článek

Not long ago, I posted about PHP templating in just PHP (which is basically HEREDOC syntax). I'm literally using that technique for some super basic templating I needed to do on this very WordPress site. The main pushback was that this kind of thing can be an XSS vulnerability. In my case, it's not, because I'm not using it for anything other than an abstraction convenience for my own hand-written strings.

Since then, we've had a couple of good articles about templating and I've seen some other approaches. I thought I'd make a quick link dump of them.

  • Chris Geelhoed took a different approach than I did, passing data to a functio then using a require statement for a template file that expects global variables you set right before the require.
  • If you're into the idea of using Twig as a PHP templating engine on your WordPress site, check out Timber. TJ Fogarty has written about this for us.
  • If Timber is a little heavy-handed, check out Sprig from Russell Heimlich. I really like this approach!
  • Jonathan Land shared how you can use Vue (inline) templates to do your templating, even in WordPress-land.
  • Charlie Walter wrote about many ways to approach PHP templating in WordPress, like in Jade, Mustache, and Twig, as well as some interesting combinations.
  • It was the first I've heard of this, but a templating language called TinyButStrong seems to fit the bill and looks like it's actively developed.

The post A Follow-Up to PHP Templating appeared first on CSS-Tricks.

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace