|
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 |
johnf Smarty Rookie
Joined: 29 Nov 2015 Posts: 7
|
Posted: Sun Nov 29, 2015 10:04 pm Post subject: Upgrade from 2 to 3 error |
|
|
I had smarty 2, changed servers and php then it would not add to database or make changes when editing...figured should upgrade to 3 but then this error..
Fatal error: Uncaught --> Smarty: Call of unknown method 'register_function'. <-- thrown in C:\wamp\www\XXXXX\libs\sysplugins\smarty_internal_templatebase.php on line 554
Can anyone help with some tips on how to render this..thanks |
|
Back to top |
|
liviu.gelea Smarty Rookie
Joined: 25 Nov 2015 Posts: 16
|
Posted: Wed Dec 02, 2015 12:57 pm Post subject: |
|
|
Hi. I'm working on upgrading smarty2 code to smarty 3 for months.
The error you're facing is due to functions being renamed and have had parameters changed. For example
Code: | register_function( etc... )
|
in smarty 2, is now used as
Code: | registerPlugin( 'function', etc... )
|
You can get a prety comprehensive list of functions that have changed in Smarty 3 if you look inside SmartyBC.class.php (the smarty backwards compatibility class ). Or you can use it instead. |
|
Back to top |
|
johnf Smarty Rookie
Joined: 29 Nov 2015 Posts: 7
|
Posted: Wed Dec 02, 2015 7:42 pm Post subject: Thank you mate |
|
|
Thanks a lot for this mate.
Smarty 2 used to work but when changed servers then trying to edit products on the website it would not save to the database in other words it would not make the change or save the edit.
The initial thought was something to do with the PHP upgrades so have been trying to upgrade smarty 2 to 3 ever since with no avail.
FYI, could not find the person who put the site together so I am stuck with an engine that is too foreign to me.
If I could get your email, would you be able to help me sort it mate?
Thanks again. |
|
Back to top |
|
johnf Smarty Rookie
Joined: 29 Nov 2015 Posts: 7
|
Posted: Wed Dec 02, 2015 9:02 pm Post subject: It works but... |
|
|
Hey there, it works error is gone when I made the following changes you suggested.
Code: |
include_once "libs/SmartyBC.class.php";
$tpl = new SmartyBC();
|
However, even after this upgrade, I still cannot save an edit or when adding a new product it is not saved into the database.
Weird...it is got to be something else, any ideas, please! |
|
Back to top |
|
liviu.gelea Smarty Rookie
Joined: 25 Nov 2015 Posts: 16
|
Posted: Thu Dec 03, 2015 11:22 am Post subject: |
|
|
Hi. Smarty does not handle business logic. However it does handle everything displayed on page, including the html attributes. If you upgraded smarty it is possible that an input receives the wrong "name" attribute. For example, an old input might have been <input name = "user_{$id}" /> which was rendered as <input name = "user_3" />. Since upgrade, it is possible that is now rendered wrongly, like <input name = "user_" /> and it is why it fails to save the data. Check the data you're posting to the page using the code inspector in the browser.
The problem can be caused by a number of things: Smarty didn't just rename functions but also changed the template syntax a bit.
look in here for some answers:
http://www.smarty.net/v3_overview
inside the smarty source there are some upgrade notes:
https://github.com/smarty-php/smarty/blob/master/SMARTY_3.0_BC_NOTES.txt
https://github.com/smarty-php/smarty/blob/master/SMARTY_3.1_NOTES.txt
If you old code didn't extend the smarty class like mine did then your problems are almost certainly caused by legacy templates and custom modifiers |
|
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
|