TWIG template engine either "TWIG" or "PHP"

Hi,
on the website http://symfony.com/doc/current/templating/PHP.html Symphony mentions that TWIG can use two engines for processing templates: TWIG and PHP.
TWIG determines the difference by the extension:
myFile.html.twig is processed by the TWIG engine,
myFile.html.php is processed by the PHP engine.
Can I convince GRAV to obey this convention?
Currently I seem to only be able to use the TWIG engine.
I need to create a template that pulls data from a MySQL database and this seems a more appealing way than writing a TWIG extension.
Anyone has insight on this topic?

Thanx in advance!

Regarz, Peter

I’m afraid I can’t answer your specific question, but why not write a plugin that pulls the data from SQL and then injects that data into the Twig variable space? Your standard Twig template then displays that data. That might be the simplest approach.

1 Like

Thanx for replying PerlKonig.
Jep, I might.
But
1. I’m not that experienced in this field and (the most important)
2. TWIG is said to have a built in mechanisme to switch engines (between TWIG and PHP, depending on the extension (".HTML.TWIG" and “.HTML.PHP”)

So, why reinvent the wheel? … I just can’t find the wheel …

Cheers, Peter

I hope someone can answer your question. If you decide to go the other route, here are two plugins that do what I mentioned:

  • Import loads files given in the frontmatter and makes the data avaialable to Twig.
  • IPLocate runs the visitor’s IP address through one or more services and injects the results into Twig.

Good luck!

Cool Perlkonig!
Thanx for your assistance!

cheers, Peter