B
B
Banny_Boom2015-06-10 13:16:37
PHP
Banny_Boom, 2015-06-10 13:16:37

How does a template engine work?

I only have this in my mind: 1. Load the template with labels ( { {
username}}, {% var1 == var2 %}, etc.) change it to <?=$username?>, etc. 3. Compile the template, then when the template is called again, check if it is compiled, if not, then ^ again, if it is, load the finished one Correctly ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2015-06-10
@shoomyst

What template engine? What you described is a template engine from 2002. And it has nothing to do with twig

S
Stalker_RED, 2015-06-10
@Stalker_RED

In general, yes, you can. Or immediately substitute the values ​​of these variables.
But in most template engines, there are a lot of additional features besides this. Look at the description of twig, smarty, etc..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question