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

SmartyCompilerException 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 -> Smarty Development
View previous topic :: View next topic  
Author Message
kaustuva
Smarty n00b


Joined: 11 Nov 2012
Posts: 2

PostPosted: Sun Nov 11, 2012 9:07 am    Post subject: SmartyCompilerException error Reply with quote

Hi,

I am having following error please help me.

[Sun Nov 11 08:57:29 2012] [error] [client 10.1.1.102] PHP Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "../templates/main.tpl" on line 1 "{include file=header.tpl}" - Unexpected ".", expected one of: "}" , " " , ATTR' in /usr/share/smarty/sysplugins/smarty_internal_templatecompilerbase.php:657\nStack trace:\n#0 /usr/share/smarty/sysplugins/smarty_internal_templateparser.php(3144): Smarty_Internal_TemplateCompilerBase->trigger_template_error()\n#1 /usr/share/smarty/sysplugins/smarty_internal_templateparser.php(3209): Smarty_Internal_Templateparser->yy_syntax_error(59, '.')\n#2 /usr/share/smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(59, '.')\n#3 /usr/share/smarty/sysplugins/smarty_internal_templatecompilerbase.php(192): Smarty_Internal_SmartyTemplateCompiler->doCompile('{include file=h...')\n#4 /usr/share/smarty/sysplugins/smarty_internal_template.php(187): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Smarty in /usr/share/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 657


Regards,
Kaustuva
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Sun Nov 11, 2012 10:09 am    Post subject: Reply with quote

Smarty3 is more strict on strings, which always must be quoted.

Code:
{include file='header.tpl'}
Back to top
View user's profile Send private message
kaustuva
Smarty n00b


Joined: 11 Nov 2012
Posts: 2

PostPosted: Sun Nov 11, 2012 10:12 am    Post subject: Reply with quote

thank you. Already I did that.
Back to top
View user's profile Send private message
heal
Smarty Rookie


Joined: 11 Mar 2013
Posts: 7

PostPosted: Mon Mar 11, 2013 1:26 pm    Post subject: same error Reply with quote

Hello, I have the same error, but I have quoted the filename.

Code:
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/data/www/site/_xhtml3/advent.tpl" on line 27 "{include file="footer.tpl"}" - Unexpected """, expected one of: "identifier"' ...


What's wrong with my code?

this don't works:
Code:
{include file='header.tpl'}

but this works:
Code:
{include 'header.tpl'}
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Tue Mar 12, 2013 4:37 pm    Post subject: Reply with quote

I can't reproduce your problem.

{include file='header.tpl'}
{include 'header.tpl'}
{include file="header.tpl"}
{include "header.tpl"}

All of above versions do work.

Which version of Smarty did you use?
Could your editor have added some not visable characters?
Back to top
View user's profile Send private message
heal
Smarty Rookie


Joined: 11 Mar 2013
Posts: 7

PostPosted: Tue Mar 12, 2013 5:05 pm    Post subject: Reply with quote

I'm using 3.1.13.
No, there aren't invisible characters in those lines.
I'm using VIM, checked the hidden characters with :set invlist

Screenshot: image sorry, here is a better screenshot: image2
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Mar 12, 2013 5:35 pm    Post subject: Reply with quote

Just an idea, when you have upgraded in the past did you:

) clear out all old files and replace with new files (for smarty core libs)
) clear out all compiled files
) clear out all cache files
Back to top
View user's profile Send private message Visit poster's website
heal
Smarty Rookie


Joined: 11 Mar 2013
Posts: 7

PostPosted: Tue Mar 12, 2013 5:38 pm    Post subject: Reply with quote

Yes.
I have downloaded the new version to other directory and included from there.
I have deleted all compiled files.
I don't use cache.

As an extra thing, the new smarty throws errors only on my production server. On my home server (same, apache, php, smarty) there are no errors. I don't understand this, because on my home server my templates are still in old format and those works with v3.1.13. without any errors. :/
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 -> Smarty Development 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