A
A
Alexander Pankov2015-03-04 11:06:53
PHP
Alexander Pankov, 2015-03-04 11:06:53

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>

How to properly organize work using Smarty, even on such a small project (authorization-registration-personal page)
Why not make one huge index.php and show the required template depending on the incoming data?
Thanks in advance for your reply!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DevMan, 2015-03-04
@PankovAlxndr

www.smarty.net/docs/en/language.function.include.tpl
www.smarty.net/docs/en/language.function.extends.tpl
www.smarty.net/inheritance

P
Puma Thailand, 2015-03-05
@opium

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

D
Dmitry Entelis, 2015-03-04
@DmitriyEntelis

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 question

Ask a Question

731 491 924 answers to any question