Closed starline closed 4 days ago
It seems you misspelled Smarty
in line 4. Does that fix your problem?
In this case the Smarty core works well. I have an error only when i want to use methods in function.php file. For example smarty_mb_str_replace
Right now i connected smarty via requare_once
Right now i connect Smarty via composer "require". So can't check this issue
It seems you misspelled
Smarty
in line 4. Does that fix your problem?
Its only namespace. This shouldn't have any effect
Ah, I see. You need to require src/functions.php
as well. Like this:
"autoload": {
"psr-4" : {
"Smarty\\" : "src/"
},
"files": [
"src/functions.php"
]
},
See https://github.com/smarty-php/smarty/blob/a1b4c9c551d01ff63220f053966c7aaa9053f89d/composer.json#L36
I have got an error when i ported Smarty via Composer autoload.
so, i guess this way can't use functions.php.
Correct me if i am wrong or tell me how to fix it.
Fatal error: Uncaught Error: Call to undefined function Smarty\Extension\smarty_mb_str_replace() in /var/www/[mysite]/src/libs/smarty/smarty/src/Extension/DefaultExtension.php:713 Stack trace: #0 [internal function]: Smarty\Extension\DefaultExtension->smarty_modifier_replace() #1 /var/www/[mysite]/src/libs/smarty/smarty/src/Extension/CallbackWrapper.php(29): call_user_func_array() #2 /var/www/[mysite]/compiled/agmin/edf7a75dc2328fd6ec4caf8f42dbb798603b2774_0.file_users.tpl.php(170): Smarty\Extension\CallbackWrapper->handle() #3 /var/www/[mysite]/src/libs/smarty/smarty/src/Template/GeneratedPhpFile.php(111): content_67196cc502a829_67969777() #4 /var/www/[mysite]/src/libs/smarty/smarty/src/Template/Compiled.php(110): Smarty\Template\GeneratedPhpFile->getRenderedTemplateCode() #5 /var/www/[mysite]/src/libs/smarty/smarty/src/Template.php(180): Smarty\Template\Compiled->render() #6 /var/www/[mysite]/src/libs/smarty/smarty/src/Template.php(655): Smarty\Template->render() #7 /var/www/[mysite]/src/libs/smarty/smarty/src/Template.php(589): Smarty\Template->_execute() #8 /var/www/[mysite]/src/libs/smarty/smarty/src/Smarty.php(2121): Smarty\Template->fetch() #9 /var/www/[mysite]/src/api/Design.php(121): Smarty\Smarty->fetch() #10 /var/www/[mysite]/app/agmin/view/users/UsersAdmin.php(114): Design->fetch() #11 /var/www/[mysite]/app/agmin/view/IndexAdmin.php(181): UsersAdmin->fetch() #12 /var/www/[mysite]/app/agmin/index.php(38): IndexAdmin->fetch() #13 {main} thrown in /var/www/[mysite]/src/libs/smarty/smarty/src/Extension/DefaultExtension.php on line 713