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

Fatal error: Uncaught --> Smarty Compiler: 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
lepusa
Smarty Rookie


Joined: 10 Apr 2015
Posts: 5

PostPosted: Fri Apr 10, 2015 3:26 pm    Post subject: Fatal error: Uncaught --> Smarty Compiler: Syntax error Reply with quote

I'm new here and right off the bat I have a request for the mods - a little more length in the Subject field please! haha

I wanted the Subject to include the word "template":

Fatal error: Uncaught --> Smarty Compiler: Syntax error in template

I'm working on a Prestashop install, and in doing so I had tweaked a few lines of a file called "product-list.tpl" in order to show more characters in the Name field of the cart (sound familiar? haha)

The only change was to a couple numbers associated with a truncate function, such as changing the number 45 to 80 on line 105:

Code:
{$product.name|truncate:45:'...'|escape:'html':'UTF-8'}


According to people in the PS forums that should have worked, but it didn't. Here is the site URL:

http://lep4u.com/joomla/store/

After making the above change, and even after undoing it, I am now getting just a blank white page with the following error:

Code:
Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "/home/content/75/9476575/html/joomla/store/themes/default-bootstrap/product-list.tpl" on line 138 "<a class="button ajax_add_to_cart_button btn btn-default" href="../../prestashop/themes/default-bootstrap/{$link-&gt;getPageLink('cart',false, NULL, "add=1&amp;id_product={$product.id_product|intval}&amp;token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">" - Unexpected "&" <-- thrown in /home/content/75/9476575/html/joomla/store/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 138


Interstingly, the changes I made had nothing to do with line 138, and I have since replaced the file with an unmodified version from the most recent working backup, but I'm still getting the error.

By the way I have deleted all caches many times, and I have also tried repairing and optimizing the PS tables in phpMyAdmin, which gives me the message "The storage engine for the table doesn't support repair". Hmmm

Anyhow, here is line 138:

Code:
<a class="button ajax_add_to_cart_button btn btn-default" href="../../prestashop/themes/default-bootstrap/{$link-&gt;getPageLink('cart',false, NULL, "add=1&amp;id_product={$product.id_product|intval}&amp;token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">


I've done a lot of reading and trying various things, but so far the only thing that has (kind of) worked has been replacing the "store" directory with a virgin one from PS, but that wipes out all of the customization we've done. The current install has our active store directory which is throwing the above error.

Sorry to be so long winded! Hopefully someone will have an easy answer for me. We need to have this up and running today if possible.

Thanks in advance for any advice!
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Apr 10, 2015 10:13 pm    Post subject: Reply with quote

Sounds like you've changed template encoding, and it is no longer UTF-8.
Back to top
View user's profile Send private message
lepusa
Smarty Rookie


Joined: 10 Apr 2015
Posts: 5

PostPosted: Fri Apr 10, 2015 10:24 pm    Post subject: Reply with quote

AnrDaemon wrote:
Sounds like you've changed template encoding, and it is no longer UTF-8.


Thanks for the reply. I was wondering about this. I edited the files with TextWrangler on a Mac, and there are options for UTF-8 without BOM, which from what I understand is correct.

I will investigate further, any other tips much appreciated.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Apr 10, 2015 10:26 pm    Post subject: Reply with quote

Other tip is to start debugging your application.
Back to top
View user's profile Send private message
lepusa
Smarty Rookie


Joined: 10 Apr 2015
Posts: 5

PostPosted: Fri Apr 10, 2015 10:51 pm    Post subject: Reply with quote

AnrDaemon wrote:
Other tip is to start debugging your application.


If you mean debugging Prestashop, I have debugging turned on which is how I got the above mentioned error.

What I don't understand is how the template files are no longer UTF-8, even the unmodified ones I have restored from previously working backups. Could the encoding have been changed during FTP transfer? I have used both Transmit and Dreamweaver for FTP on the Mac.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Apr 10, 2015 11:55 pm    Post subject: Reply with quote

I did mean general purpose debugging.
You know, step by step execution, variable monitoring?

Also stop using FTP already. Forget its existence and never tell anyone you've used it. You have SSH, use it.
Back to top
View user's profile Send private message
lepusa
Smarty Rookie


Joined: 10 Apr 2015
Posts: 5

PostPosted: Sat Apr 11, 2015 3:25 am    Post subject: Reply with quote

AnrDaemon wrote:
I did mean general purpose debugging.
You know, step by step execution, variable monitoring?

Also stop using FTP already. Forget its existence and never tell anyone you've used it. You have SSH, use it.


Smarty.

Off to do some reading now, see you in a couple of weeks.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Apr 12, 2015 8:25 am    Post subject: Reply with quote

Your template source got escaped.

Eaxample
Code:
{$link->getPageLink(...)


became
Code:
{$link-&gt;getPageLink(...)
Back to top
View user's profile Send private message
lepusa
Smarty Rookie


Joined: 10 Apr 2015
Posts: 5

PostPosted: Sun Apr 12, 2015 2:41 pm    Post subject: Reply with quote

U.Tews wrote:
Your template source got escaped.

Eaxample
Code:
{$link->getPageLink(...)


became
Code:
{$link-&gt;getPageLink(...)


I saw that, and putting it back in the box it escaped from helped to fix the issue, whatever that means, lol. In other words, I replaced &gt; with > in the above.

The other issue was that a direct path got somehow injected into the file:
Code:
../../prestashop/themes/default-bootstrap/


Removing the above was the second piece of the puzzle.

How does a template file get escaped anyhow?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Apr 12, 2015 5:35 pm    Post subject: Reply with quote

Maybe by Dreamweaver or FTP
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