Good day. I am writing a php engine. I want to make a convenient template engine for layout. I use .tpl files as in DLE. I would like to know how to make the same labels as in DLE of type {title}, {list}, etc.

For example, there is a file list.tpl with a specific content. The question is how to make the contents of the list.tpl file output via the {list} tag?

  • There is a lot of unnecessary in them. And so - yes, there is what is required. - Oleg

2 answers 2

use one of the most popular template engines - smarty or twig

    preg_match_all('/\{([\\w]+)(?:[^\{\}]+)\}/', $subject, $arr_match); 

    I gave you the direction to move, but better follow the advice of @Barton .