Hello! I have a problem here, I can tell me how to solve it just did not come across before.
I created a template loading and page loading function.
function loadPage($smarty, $controllerName, $actionName = "index"){ include_once PathPrefix . $controllerName . PathPostfix; $function = $actionName . "Action"; $function($smarty); } /* * Загрузка шаблона * * $smarty - обьект шаблонизатора * $templateName - название файла шаблона * * методом display() передаем название шаблона как параметр */ function loadTemplate($smarty, $templateName){ $smarty->display($templateName.TemplatePostfix); }
Created the index.tpl template
<html> <head> <title>{$pageTitle}</title> </head> <body> {$pageTitle} </body> </html>
When I type in the line http: //myshop.local/? Controller = index & action = index , I get the following error:
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'index.tpl'' in C:\xampp\htdocs\myshop.local\library\Smarty\libs\sysplugins\smarty_internal_templatebase.php:127 Stack trace: #0 C:\xampp\htdocs\myshop.local\library\Smarty\libs\sysplugins\smarty_internal_templatebase.php(362): Smarty_Internal_TemplateBase->fetch('index.tpl', NULL, NULL, NULL, true) #1 C:\xampp\htdocs\myshop.local\library\mainFunctions.php(29): Smarty_Internal_TemplateBase->display('index.tpl') #2 C:\xampp\htdocs\myshop.local\controllers\IndexController.php(18): loadTemplate(Object(Smarty), 'index') #3 C:\xampp\htdocs\myshop.local\library\mainFunctions.php(16): indexAction(Object(Smarty)) #4 C:\xampp\htdocs\myshop.local\www\index.php(13): loadPage(Object(Smarty), 'Index', 'index') #5 {main} thrown in C:\xampp\htdocs\myshop.local\library\Smarty\libs\sysplugins\smarty_internal_templatebase.php on line 127
I just started to get it right with all of this and I can’t figure out where I’ve done it, tell me about it. Thank!