How to organize the work with Smarty?

Hello!
There is a desire to do the right thing service with php and smarty
Page login-registration-personal page user-exit pages

So:
files *.php (aka index.php) produce calculations, the function calls required by the logic and do assign variables to Smarty and call the correct template? (no more no less)

For example authorization form
1) index.php checks for session-cookie, if nothing displays the form template registration forma.tpl (where the html form)? if there are from personal timetable page.tpl

2) In this form(forma.tpl) is submit, which leads to the file auth.php which in turn makes authorization and displays your timetable template.tpl (in which the data from the database), working with data(personal account) based on the AJAX requests to php and process the result in JS, then smarty is not needed.

Is it possible to create a template wrapper that contains meta-link-script and change the content it points to (authorization form-page personal account) (I feel towards fetch necessary to dig), if Yes, then how to do it==to use it in smarty?

index.php - check or login or personal page - print forma.tpl or timetable.tpl(leach.page)
auth.php - works when it comes to the POST with forma.tpl if all displays a good timetable.tpl
exit.tpl - works when it comes to the POST with the timetable.tpl - (demolish cookies, etc) output forma.tpl

main.tpl - ??? (same as below?)

<link>



 {content} (from other tpl such as forma.tpl - tumetable.tpl)
<scripts>

</scripts>


How in General to organize the work using Smarty, even on such a small project (authorization-check-personal page)
Not to make one huge index.php and depending on the incoming data to show the desired template?

Thanks in advance for the answer!
September 18th 19 at 23:39
4 answers
September 18th 19 at 23:41
Solution
Thank you, inheritance in Smarty will really help to share all funktsionalnye blocks! - cordelia_Stant commented on September 18th 19 at 23:44
September 18th 19 at 23:43
Solution
Thank you, inheritance in Smarty will really help to share all funktsionalnye blocks! - cordelia_Stant commented on September 18th 19 at 23:46
September 18th 19 at 23:45
Smarti is not what the last century the century before last, why not take advantage of any framework of new generation the same yii2 or laravel
Don't see the connection. After all, most people use and the template engine and the framework. And in any Yii2 Smarty - the usual thing: www.yiiframework.com/doc-2.0/guide-tutorial-templa... - cordelia_Stant commented on September 18th 19 at 23:48
September 18th 19 at 23:47
off: and, you can not use the brakes smarti.
php itself is a great templating engine.
: this mantra is that, do not bother) - Adah_MacGyver commented on September 18th 19 at 23:56
And this is, for example (for the same authorization form), to prevent html from php? - cordelia_Stant commented on September 18th 19 at 23:50
Since PHP is a good templating engine? Show me an example with avtoclavirovnie in pure PHP - cordelia_Stant commented on September 18th 19 at 23:53

Find more questions by tags PHPOrganization of the workSmarty