|
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 |
patrmich Smarty Rookie
Joined: 13 Nov 2012 Posts: 7
|
Posted: Fri Nov 24, 2017 9:48 am Post subject: Uncaught exception Syntax Error |
|
|
Hello,
In a tpl file (product-list.tpl), on line 113, I have got the following :
{rating id=$product.id_product}
This leads to the following error :
PHP Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/.../product-list.tpl" on line 113 "{rating id=$product.id_product}" unknown tag "rating"'
Would you know anything to the origin of this error.
I thank you in advance for any help.
Patrick |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Nov 25, 2017 1:29 am Post subject: |
|
|
The message is perfectly clear: Your instance of Smarty don't know anything about {rating}. |
|
Back to top |
|
patrmich Smarty Rookie
Joined: 13 Nov 2012 Posts: 7
|
Posted: Mon Nov 27, 2017 1:43 pm Post subject: |
|
|
Thank you for your reply.
Unfortunately, I am not a developer.
Could you be so kind to give me some information about what could be done to allow Smarty to know something about {rating} ?
Thank you in advance for any help.
Patrick |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Nov 27, 2017 7:04 pm Post subject: |
|
|
No idea. Ask your website author. |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Fri Dec 01, 2017 6:22 am Post subject: |
|
|
The syntax suggests this is a custom function.
https://www.smarty.net/docs/en/language.syntax.functions.tpl
As such, the template file containing this code may be getting included into a parent template where the 'rating' function is defined. Or, there may be a Smarty plugin that was supposed to come with the appication this template belongs to. |
|
Back to top |
|
patrmich Smarty Rookie
Joined: 13 Nov 2012 Posts: 7
|
Posted: Fri May 11, 2018 9:41 am Post subject: |
|
|
Hello,
Some months after my last post, I am still trying to solve these following errors :
PHP Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/.../product-list.tpl" on line 113 "{rating id=$product.id_product}" unknown tag "rating"'
and
PHP Fatal error: Class 'CategoryListRatings' not found in /cache/smarty/compile/aa/aa/xx/xxxxx.file.product-list.tpl.php on line 147
I am adding two pieces of information :
In the module php related file, the code is the following :
Code: |
public function hookDisplayHeader($params){
$this->context->smarty->registerPlugin('function', 'rating', array('CategoryListRatings', 'rating'));
}
|
In the file.product-list.tpl.php, the line 147 is the following :
Code: |
<?php echo CategoryListRatings::rating(array('id'=>$_smarty_tpl->tpl_vars['product']->value['id_product']),$_smarty_tpl);?>
|
Do you think that there is anything wrong in the function ?
I thank you in advance for any help.
Patrick |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri May 11, 2018 12:24 pm Post subject: |
|
|
Were your registration function actually called, when template was executed? |
|
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
|