Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Uncaught exception Syntax Error

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
patrmich
Smarty Rookie


Joined: 13 Nov 2012
Posts: 7

PostPosted: Fri Nov 24, 2017 9:48 am    Post subject: Uncaught exception Syntax Error Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sat Nov 25, 2017 1:29 am    Post subject: Reply with quote

The message is perfectly clear: Your instance of Smarty don't know anything about {rating}.
Back to top
View user's profile Send private message
patrmich
Smarty Rookie


Joined: 13 Nov 2012
Posts: 7

PostPosted: Mon Nov 27, 2017 1:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Nov 27, 2017 7:04 pm    Post subject: Reply with quote

No idea. Ask your website author.
Back to top
View user's profile Send private message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Fri Dec 01, 2017 6:22 am    Post subject: Reply with quote

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
View user's profile Send private message
patrmich
Smarty Rookie


Joined: 13 Nov 2012
Posts: 7

PostPosted: Fri May 11, 2018 9:41 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri May 11, 2018 12:24 pm    Post subject: Reply with quote

Were your registration function actually called, when template was executed?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP