View previous topic :: View next topic |
Author |
Message |
Saich Smarty n00b
Joined: 22 Apr 2014 Posts: 4
|
Posted: Fri May 13, 2016 3:34 pm Post subject: Smarty and TinyMVC - Error autoloader! |
|
|
Hello! Before using an older version of Smarty with TinyMVC. There were no problems. But now I tried to install and got the error:
Code: | Warning: Uncaught exception 'LogicException' with message 'Class Smarty_Internal_Data could not be loaded' in /home/stinvest/domains/freebc.ru/public_html/libs/smarty/Smarty.class.php:81 Stack trace: #0 [internal function]: spl_autoload('Smarty_Internal...') #1 /home/stinvest/domains/freebc.ru/public_html/libs/smarty/Smarty.class.php(81): class_exists('Smarty_Internal...', true) #2 /home/stinvest/domains/freebc.ru/public_html/tinymvc/myapp/plugins/tinymvc_library_smarty.php(6): require_once('/home/stinvest/...') #3 /home/stinvest/domains/freebc.ru/public_html/tinymvc/sysfiles/plugins/tinymvc_load.php(112): spl_autoload('TinyMVC_Library...') #4 /home/stinvest/domains/freebc.ru/public_html/tinymvc/myapp/controllers/default.php(16): TinyMVC_Load->library('Smarty', 'smarty') #5 /home/stinvest/domains/freebc.ru/public_html/tinymvc/sysfiles/TinyMVC.php(120): Default_Controller->index() #6 /home/stinvest/domains/freebc.ru/public_html/index.php(38): tmvc->main() #7 {main} thrown in /home/stinvest/domains/freebc.ru/public_html/libs/smarty/Smarty.class.php on line 81
Fatal error: spl_autoload(): Class TinyMVC_Library_Smarty could not be loaded in /home/stinvest/domains/freebc.ru/public_html/tinymvc/sysfiles/plugins/tinymvc_load.php on line 112 |
How to solve this problem? I connect so as described here:
http://tinymvc.com/documentation/index.php/Documentation:Templates |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri May 13, 2016 3:41 pm Post subject: Re: Smarty and TinyMVC - Error autoloader! |
|
|
Saich wrote: | Hello! Before using an older version of Smarty with TinyMVC. There were no problems. But now I tried to install and got the error:
Code: | Warning: Uncaught exception 'LogicException' with message... |
How to solve this problem? I connect so as described here:
http://tinymvc.com/documentation/index.php/Documentation:Templates |
А можно то же самое, но в читаемом виде?… |
|
Back to top |
|
Saich Smarty n00b
Joined: 22 Apr 2014 Posts: 4
|
Posted: Fri May 13, 2016 9:08 pm Post subject: Re: Smarty and TinyMVC - Error autoloader! |
|
|
AnrDaemon wrote: | Saich wrote: | Hello! Before using an older version of Smarty with TinyMVC. There were no problems. But now I tried to install and got the error:
Code: | Warning: Uncaught exception 'LogicException' with message... |
How to solve this problem? I connect so as described here:
http://tinymvc.com/documentation/index.php/Documentation:Templates |
А можно то же самое, но в читаемом виде?… |
подключал раньше smarty 3 к TinyMVC, теперь вот ошибка автозагрузчика как я понял. Версия 3.1-DEV подключалась без проблем. |
|
Back to top |
|
Saich Smarty n00b
Joined: 22 Apr 2014 Posts: 4
|
Posted: Sat May 14, 2016 8:54 am Post subject: |
|
|
Проблема решена. Подключаем не сам смарти, а автозагрузчик |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun May 15, 2016 12:51 am Post subject: |
|
|
Ну, вообще-то об этом в инструкции написано.
Кстати, в родном автозагрузчике есть баг.
Небольшой, но неприятный.
Он регистрирует свой загрузчик на верх стека. |
|
Back to top |
|
zimorok Smarty n00b
Joined: 18 Aug 2016 Posts: 3
|
Posted: Thu Aug 18, 2016 2:54 am Post subject: |
|
|
So, is the problem solve? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Aug 18, 2016 2:26 pm Post subject: |
|
|
Yes, the problem was the incorrect inclusion.
OP did include Smarty.class.php instead of the autoloader. |
|
Back to top |
|
zimorok Smarty n00b
Joined: 18 Aug 2016 Posts: 3
|
Posted: Fri Aug 19, 2016 12:00 pm Post subject: |
|
|
How to solve it?
Please help. I still have the error. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Aug 22, 2016 8:36 pm Post subject: |
|
|
Include the autoloder, not Smarty itself, or just use Composer. |
|
Back to top |
|
vengeance Smarty n00b
Joined: 20 Oct 2016 Posts: 1
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Oct 20, 2016 11:06 pm Post subject: |
|
|
Надо прочитать топик… прежде чем писать в него. |
|
Back to top |
|
rdg Smarty n00b
Joined: 11 Jan 2017 Posts: 2
|
Posted: Wed Jan 11, 2017 4:24 pm Post subject: |
|
|
Hi Everyone,
I'm having a similar issue. I'm also using TinyMVC with Smarty 3.0.5, I'm looking to upgrade to 3.1.30 for bug/security fixes but I cannot get it to work.
I've updated tinymvc_library_smarty_wrapper.php to use this:
Code: | <?php
// important so the TinyMVC and Smarty autoloaders work together!
define('SMARTY_SPL_AUTOLOAD', 1);
// require the Smarty class
require(TMVC_BASEDIR . '/myclasses/smarty/libs/Autoloader.php');
Smarty_Autoloader::register();
//require(TMVC_BASEDIR . '/myclasses/smarty/libs/Smarty.class.php');
class TinyMVC_Library_Smarty_Wrapper Extends Smarty
{
function __construct()
{
parent::__construct();
$this->setTemplateDir(TMVC_BASEDIR . '/myapp/smarty/templates/');
$this->setCompileDir(TMVC_BASEDIR . '/myapp/smarty/templates_c/');
$this->setConfigDir(TMVC_BASEDIR . '/myapp/smarty/configs/');
$this->setCacheDir(TMVC_BASEDIR . '/myapp/smarty/cache/');
}
} |
However I get an error when my templates try to call a custom function "property_image":
Code: | Message: Class Smarty_Internal_Compile_Property_Image could not be loaded |
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
rdg Smarty n00b
Joined: 11 Jan 2017 Posts: 2
|
Posted: Wed Jan 18, 2017 9:37 pm Post subject: |
|
|
Thank you for your reply! Smarty 3.1.21 was the last version that could be included using the documentation described here:
http://www.tinymvc.com/documentation/index.php/Documentation:Templates
I was able to get Smarty 3.1.30 working by adding this to the bottom of TinyMVC.php
Code: | ///// Added For Smarty Autoloader.php Suppport
function __autoload($classname) {
// other stuff that had been here before
if (substr($classname, 0, 15) == "Smarty_Internal") {
$classname = "Smarty/sysplugins/" . strtolower($classname);
require_once $classname . ".php";
}
} |
I will look into using the Smarty bootstrap method. |
|
Back to top |
|
danny36 Smarty Rookie
Joined: 14 Jul 2004 Posts: 27 Location: Italy - Arezzo (Tuscany)
|
Posted: Thu Apr 05, 2018 9:52 am Post subject: |
|
|
rdg thank you very much!!! |
|
Back to top |
|
|