Answer the question
In order to leave comments, you need to log in
How to create template using .tpl .php formats?
How to register variables in a .php file and display them in .tpl, how to link these files together?
Answer the question
In order to leave comments, you need to log in
It all depends on the template engine that suits you.
twig.sensiolabs.org
https://github.com/smarty-php/smarty/
https://github.com/alexeyrybak/blitz ( habrahabr.ru/post/18695 )
habrahabr.ru/post/128645
Or whatever something like xslt:
https://github.com/bem/bh-php
If you need a more precise answer - decide on the question ;-)
page.php
$name = 'вася';
$email = '[email protected]';
$smarty->assign(array(
'name' => $name,
'email' => $email
));
return $this->display(__FILE__, 'page.tpl');
<p>
Привет, {$name}!
</p>
<p>
Теперь твой емейл — {$email}.
</p>
Learn the concept of mvc, it is well described how to transfer data from the controller to the view.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question