View previous topic :: View next topic |
Author |
Message |
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Thu Jun 10, 2010 6:37 pm Post subject: Upgrading from Smarty 2 to Smarty 3 |
|
|
Smarty 3 is an entire remake, and it differs from Smarty 2. But the template rendering, and plugins work as in earlier version. However, you may need to consider to upgrade to Smarty 3.
The developers have a quick documentation for this process at:
http://dev.smarty.net/wiki/index.php/Upgrading_from_Smarty_2
To upgrade, please be sure that your server supports PHP 5.
Otherwise, it wont work correctly. Also, check if you have used {php} tags in your older files.
Manual written for 2.6.14 still works for many references. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Jun 10, 2010 6:46 pm Post subject: |
|
|
There are not newlines generated by {if} tags, can you provide an example? |
|
Back to top |
|
kosemuckel Smarty Rookie
Joined: 13 May 2007 Posts: 15
|
Posted: Fri Dec 31, 2010 10:46 am Post subject: |
|
|
would be nice to have this public and not restricted |
|
Back to top |
|
idontknow Smarty Rookie
Joined: 22 Jan 2011 Posts: 6 Location: Germany
|
Posted: Sat Jan 22, 2011 2:30 am Post subject: |
|
|
kosemuckel wrote: |
would be nice to have this public and not restricted |
this is totally true!! |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Jan 22, 2011 3:42 am Post subject: |
|
|
There are upgrade notes with the Smarty 3 distro. |
|
Back to top |
|
Chrissio Smarty Rookie
Joined: 07 Oct 2014 Posts: 10
|
Posted: Tue Jan 06, 2015 4:21 pm Post subject: |
|
|
mohrt wrote: | There are upgrade notes with the Smarty 3 distro. |
... but - i don't understand it! The only i see in first tests is:
Quote: | Fatal error: Call to a member function createTemplate() on null in C:\xampp\htdocs\Smarty3\libs\sysplugins\smarty_internal_templatebase.php on line 49 |
With this error message (without any further info) no one can do something!
Upgrade description from ver. 2 to ver. 3 is very very bad! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jan 06, 2015 10:57 pm Post subject: |
|
|
Chrissio wrote: | mohrt wrote: | There are upgrade notes with the Smarty 3 distro. |
... but - i don't understand it! The only i see in first tests is:
Quote: | Fatal error: Call to a member function createTemplate() on null in C:\xampp\htdocs\Smarty3\libs\sysplugins\smarty_internal_templatebase.php on line 49 |
With this error message (without any further info) no one can do something!
Upgrade description from ver. 2 to ver. 3 is very very bad! |
Actually, this line indicates that you are doing something you should never attempt to do. |
|
Back to top |
|
Chrissio Smarty Rookie
Joined: 07 Oct 2014 Posts: 10
|
Posted: Tue Jan 06, 2015 11:19 pm Post subject: |
|
|
AnrDaemon wrote: |
Actually, this line indicates that you are doing something you should never attempt to do. |
Hello,
but the script runs with Smarty2...
After 4 hours searching with Smarty3 I found the Error:
It was to change 1 line from
Code: | $tpl = some_function_somewhere(); |
to
The problem is, most Smarty error Messages are the same like
Quote: | Fatal error: Call to a member function createTemplate() on null in C:\xampp\htdocs\Smarty3\libs\sysplugins\smarty_internal_templatebase.php on line 49 |
But to fix the error you need to search in many other files, because the Error isn't in smarty_internal_templatebase.php on line 49 - it is somewhere in another File outside of smarty folder, and smarty debug dosn't run in this case.
Thats very unfortunely! And the same like an error Message from apache webserver because an error in postfix... |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Jan 07, 2015 12:18 am Post subject: |
|
|
Is that line in any of the Smarty code, or is that in your application code? |
|
Back to top |
|
Chrissio Smarty Rookie
Joined: 07 Oct 2014 Posts: 10
|
Posted: Wed Jan 07, 2015 10:24 am Post subject: |
|
|
AnrDaemon wrote: | Is that line in any of the Smarty code, or is that in your application code? |
I wrote: "it is somewhere in another File outside of smarty folder" and means "has nothing to do with a file in smarty engine".
It is a line in application code - but php says "you have an error in smarty engine".
An this is the problem because php tells an error in a place fare away from the really error. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Jan 07, 2015 11:25 am Post subject: |
|
|
Nowhere in your post I see that there's an "error in Smarty engine".
Error in your application code? That one I see. |
|
Back to top |
|
Chrissio Smarty Rookie
Joined: 07 Oct 2014 Posts: 10
|
Posted: Wed Jan 07, 2015 9:57 pm Post subject: |
|
|
AnrDaemon wrote: | Nowhere in your post I see that there's an "error in Smarty engine".
Error in your application code? That one I see. |
Sorry, i want to change from smarty 2 to smarty 3!
The script runs correctly in smarty 2 /php5.6 with deprecated messages - but it produces error messages after change to smarty 3. Exactly the big problem are the error messages - all Errors are shown as Errors in "smarty_internal_templatebase.php"!
Exactly that is the problem because the reason of the error is NOT THE SMARTY ENGINE...
But - i want to end writing with you because your post give no hints for to get correct error messages because normally an error message should be like "Error in filexy.php" if the error ist in filexy.php. In this case the error was in filexy, but php says the error ist in smarty. EOM |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Jan 07, 2015 10:17 pm Post subject: |
|
|
If there's no Smarty class instance available, when internal plugins run, that could only mean, that you're calling internal template functions directly, which you SHOULD NEVER EVER DO. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Jan 10, 2015 4:53 pm Post subject: |
|
|
Where did you need to change a line to
Show a piece of code around it.
$tpl is an internal variable used in Smarty3.
Did you extend the Smarty class and overload some of the Smarty methods?
If yes that code must be reviewed carefully because of internal changes.
One major change is in plugins. The second parameter is no longer the Smarty but the template object $template.
Code: | void smarty_function_name($params,
Smarty_Internal_Template $template);
|
Normally an access to Smarty properties and methods should be automatically remapped to the Smarty object. But you have direct access to the Smarty object by using
|
|
Back to top |
|
Chrissio Smarty Rookie
Joined: 07 Oct 2014 Posts: 10
|
Posted: Mon Jan 19, 2015 11:19 am Post subject: |
|
|
U.Tews wrote: | Where did you need to change a line to
Show a piece of code around it.
$tpl is an internal variable used in Smarty3.
|
Hello Uwe,
a very useful hint. Now i can recognize the reason of some other errror messages.
$tpl was used in the script with Smarty2 - i have to change it in the script...
Thank you. |
|
Back to top |
|
|