Template in template (.tpl) smarty

hey, Beginning in a few weeks, I have been trying to program a PHP application using a smarty template solution. Now an easy question for all professionals: How can I get a template in a template? One example: index.php (page.tpl) includes my login.php (login.tpl)

In the smarty documentation, I found this function: {include file="$tpl_name.tpl"}

But where is my login.php controller? When this function includes the login.tpl file, do I only have HTML code or?

Can someone explain this to me or give me a sample / tutorial?

Sorry for my bad english

Regards

+3
source share
2 answers

login.tpl Smarty ( html, Smarty). Smarty.

, . :
1) login.tpl index.tpl, , .
2) , . "login.php", login.php , / .
3) , , index.php( , ).

, : ( ) , / . login.tpl , html , , Smarty, .

+2

- , . smarty .

<html>
<head>
  <title>{$title}</title>
</head>
<body>
{include file='login.tpl'}

, , .

, HTML-, , :

{include_php file='/path/to/login.php'}
+5

Source: https://habr.com/ru/post/1785634/


All Articles