|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Fri Nov 06, 2009 8:47 am Post subject: How to resolve autoload / spl conflicts? |
|
|
Here is my directory structure of class files, and auto loaded with __autoload():
Code: | <root>/classes/*/class.*.inc.php |
Smarty and PHPMailer are the only two third party applications in my reservoir. Hence I do it manually:
Code: | # Runnng copy
#require_once(__ROOT__.'/classes/third/smarty-2.6.2/Smarty.class.php');
# Problomatic
require_once(__ROOT__.'/classes/third/smarty-3.0.1b/Smarty.class.php'); |
and then define __autoload() as usual.
But the order of Smarty Includes and __autoload() do not really have a sense. However, it does not allow me to use Smarty 3.
And everything is good with Smarty 2.6, but not with 3. I am running both the versions.
How can I resolve this conflict? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Nov 06, 2009 3:03 pm Post subject: |
|
|
Have you tried the latest SVN of Smarty 3? |
|
Back to top |
|
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Fri Nov 06, 2009 4:09 pm Post subject: Latest version |
|
|
Yes, I am sure, it is the latest version of Smarty 3. Any luck?
Finally my words are:
The distributed version of Smarty has some problems, while the current SVN files at http://smarty-php.googlecode.com/svn/trunk/libs are good.
I am now, testing...
Thanks. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Nov 06, 2009 10:37 pm Post subject: |
|
|
The latest SVN removes the use of spl_autoload and instead uses the smartyAutoloader by default. |
|
Back to top |
|
Michael White Smarty Rookie
Joined: 08 Oct 2009 Posts: 20
|
Posted: Sat Nov 07, 2009 10:44 pm Post subject: Released Smarty 3 Beta Autoloader bug. |
|
|
In the version of Smarty 3 Beta (Smarty-3.0-b1) released on Oct. 31st (the download link on the downloads page - not in SVN) the Smarty.class.php script has the following on line 95:
Code: |
spl_autoload_register();
|
The autoloader should be registered as follows:
Code: |
spl_autoload_register('smartyAutoload');
|
Just replace the current line 95 with the new one to fix this bug. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Nov 09, 2009 5:51 pm Post subject: |
|
|
By define('SMARTY_SPL_AUTOLOAD',1); in your script you can now select the buildin 'spl_autoload' instead of the default 'smartyAutoloader'.
Note that the constant must be defined before you include the Smarty.class.php.
The corresponding update is in the SVN. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|