Good day. Did not find the answer. Therefore we will set it.
Is it possible to convert a variable to a template style, if so, please give an example. Template side is not interested.
It is necessary that from $name become {name} , and for example from an array

 $massiv = array('lala' => 'ляля', 'topolya' => 'тополя'); 

it became not

 $massiv['lala'] 

but

 {massiv['lala']} 

or better yet

 {massiv[lala]} 

The conclusion is not like this:

<?= 'Привет, '.$name.'!'; ?>

And this:

Привет, {name}!

  • The logic with arrays is not clear. 'lala' and 'topolya' are the values, and the keys for them will be 0 and 1 , respectively. And why is array initialization being replaced with its first value? And about the simple change of variables - look towards preg_replace - fremail
  • @fremail, weeds with arrays of even I have already done business here. Of course these are the values, I’ll fix it now. And about the initialization - just an example of how the output of the array value with the necessary key should look like. Preg_replace as far as I know does not allow to execute an idea. - Dmitry Goncharov
  • <?=$massiv['lala']?> , no? Or $object->{$massiv['lala']}->go(); ? It is not clear what you want in general. - Goncharov Alexander
  • Naturally the first, what's the object in general? Only this way: <? = {Name}?> Re-read the topic again, and if you don’t understand, then again and again. In my opinion everything is described there, which is necessary. - Dmitry Goncharov
  • one
    @Dmitry Potter are programmers here, not prophets. If you want an answer - explain correctly what you want. Here, for example. Нужно, чтобы из $name стало {name} - where did it become when outputting HTML to PHP? Or when calling the property of an object? Or in Vasily’s neighbor’s CRM?) I suspect that the first thing is to write this way. Хочу вывод переменных PHP в HTML сделать следущими способами {..способы..} какими средствами кроме сторонних библиотек можно этого добиться? - Goncharov Alexander

0