|
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 |
luizkim Smarty n00b
Joined: 03 May 2014 Posts: 3
|
Posted: Sat May 03, 2014 2:33 pm Post subject: Syntax error |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon May 05, 2014 8:57 pm Post subject: |
|
|
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 |
|
|
|
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
|