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

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 -> Bugs
View previous topic :: View next topic  
Author Message
luizkim
Smarty n00b


Joined: 03 May 2014
Posts: 3

PostPosted: Sat May 03, 2014 2:33 pm    Post subject: Syntax error Reply with quote

I receave this error:
Code:
Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "D:\Luiz Kim\Apps\cmsframework\Libs\ControleOnline\Core\Views\MagicController.tpl" on line 14 "{/if}" unclosed {else} tag <-- thrown in D:\Luiz Kim\Apps\cmsframework\Libs\Smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 14


But the code is correct:
Code:

{if isset($data.actionFile)}
    {include file=$data.actionFile}
{else}
    {extends file="Templates/"|cat:$data.templateName|cat:".tpl"}
    {block "content"}
        {if is_array($data.data)}
            {assign var="array" value=$data.data}
            {include file="doctrineCollection.tpl"}
        {elseif is_object($data.data)}
            {assign var="object" value=$data.data}
            {include file="doctrineObject.tpl"}
        {/if}
    {/block}
{/if}
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Mon May 05, 2014 8:57 pm    Post subject: Reply with quote

Currently template inheritance is a compile time process and the extends must be the first statement of a file. It can't be within an if condition.

See http://www.smarty.net/docs/en/language.function.extends.tpl

The solution would be to put the code of the {else} section into its own template file which gets call at {else}...
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 -> Bugs 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