Answer the question
In order to leave comments, you need to log in
How to organize work with Smarty?
Hello!
There is a desire to do the right service on php and smarty
Entry
-
registration pages-user's personal page-exit pages sample? (no more no less)
For example, an authorization form
1) index.php checks session cookies, if there is nothing - displays the registration form template forma.tpl (there is an html form)? if there is immediately a personal timetable.tpl page
2) There is a submit on this form (forma.tpl), which leads to the auth.php file, which in turn performs authorization and displays its timetable.tpl template (in which the data is from the database), working with data (personal account) based on AJAX requests to php and processing the result in JS, smarty is not needed here.
Is it possible to create a wrapper template that contains meta-link-script and change the content in it (authorization form-personal account page) (I feel like I need to dig in the direction of fetch), if so, how to do it == use it in smarty?
index.php - check either login or personal page - display forma.tpl or timetable.tpl(personal page)
auth.php - work when POST with forma.tpl arrives, if everything goes well output timetable.tpl
exit.tpl - works when POST comes with timetable.tpl - (delete cookies, etc.) display forma.tpl
main.tpl - ??? (such as below?)
<head>
<link>
</head>
<html>
<body>
{content} (из других tpl таких как forma.tpl - tumetable.tpl)
<scripts>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
www.smarty.net/docs/en/language.function.include.tpl
www.smarty.net/docs/en/language.function.extends.tpl
www.smarty.net/inheritance
Smart is not like the last century, it's the century before last, why not use any new generation framework, the same yii2 or laravel
off: and you can also not use a braked smart.
php itself is a great templating engine.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question