|
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 |
patfrwar Smarty n00b
Joined: 22 Jan 2014 Posts: 2
|
Posted: Wed Jan 22, 2014 1:19 pm Post subject: Good TPL in Smarty 2 and now Bad in Smarty 3 |
|
|
hello
I am french and i have a problem
i use a Photo gallery named PIWIGO , the last version 2.5.3 work with smarty 2 and i have made a TPL and it works fine
now PIWIGO have a new version 2.6 and it work with smarty 3 and now, my TPL not work I have this message :
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "D:\www\piwigo\template-extension\my_index.tpl" on line 126 "(<li class="BtTag">" - Unexpected "BtTag", expected one of: "}" , " " , ATTR' in D:\www\piwigo\include\smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 665
the part of code is :
Code: |
{assign var="SiTag" value=$TITLE|strpos:"Tag"}
{* fil d'ariane des albums *}
{if ($SiTag)==false}
<ul class="breadcrumb">
{assign var="Lst_Arbo_Cat" value=$TITLE|explode:" / "}
{foreach from=$Lst_Arbo_Cat item=cat}
{assign var="revcat" value=$cat|strrev}
{assign var="cat_san_nb_rev" value=$revcat|strstr:">a/"}
{assign var="cat_san_nb" value=$cat_san_nb_rev|strrev}
{if empty ($cat_san_nb)}
{assign var="affcat" value=$cat}
{else}
{assign var="affcat" value=$cat_san_nb}
{/if}
<li>{$affcat}</li>
{/foreach}
</ul>
{* fin fil d'ariane des albums *}
{* début fil d'ariane des Tags *}
{else}
{assign var="epur_tag" value=$TITLE|replace:' title="Voir les photos liées uniquement à ce tag"':' '}
{assign var="epur1_tag" value=$epur_tag|replace:'retirer ce tag de la liste':' '}
{assign var="Lst_tag_index" value=$epur1_tag|explode:"index.php?/tags/"}
{assign var="nbElm" value=$Lst_tag_index|@count}
{* Si un Seul Tag *}
{if ($nbElm)==2}
{assign var="pos1" value=$Lst_tag_index[1]|strpos:"["}
{assign var="NbPhoto" value=$Lst_tag_index[1]|substr:($pos1+1):-1}
{assign var="pos1" value=$Lst_tag_index[1]|strpos:" >"}
{assign var="IdTag" value=$Lst_tag_index[1]|substr:0:$pos1}
{assign var="NomTag" value=$Lst_tag_index[1]|substr:$pos1+2}
{assign var="pos1" value=$NomTag|strpos:"</a>"}
{assign var="NomTag" value=$NomTag|substr:0:$pos1}
<ul>
<li class="BtTag">
<a href="#" >{$NomTag}</a>
</li>
</ul>
{* Si deux Tag *}
{elseif ($nbElm)==3}
{assign var="pos1" value=$Lst_tag_index[2]|strpos:"["}
{assign var="NbPhoto" value=$Lst_tag_index[2]|substr:($pos1+1):-1}
{assign var="pos1" value=$Lst_tag_index[1]|strpos:" >"}
{assign var="IdTag1" value=$Lst_tag_index[1]|substr:0:$pos1}
{assign var="NomTag1" value=$Lst_tag_index[1]|substr:($pos1+2)}
{assign var="pos1" value=$NomTag1|strpos:"</a>"}
{assign var="NomTag1" value=$NomTag1|substr:0:$pos1}
{assign var="pos1" value=$Lst_tag_index[2]|strpos:" >"}
{assign var="IdTag2" value=$Lst_tag_index[2]|substr:0:$pos1}
{assign var="NomTag2" value=$Lst_tag_index[2]|substr:($pos1+2)}
{assign var="pos1" value=$NomTag2|strpos:"</a>"}
{assign var="NomTag2" value=$NomTag2|substr:0:$pos1}
<ul>
<li class="BtTag">
<a href="#" >{$NomTag1}</a>
<ul class="GestTag">
<li><a href="index.php?/tags/{$IdTag1}" >{'CeTag'|@translate}</a></li>
<li><a href="index.php?/tags/{$IdTag2}" >{'AutreTag'|@translate}</a></li>
</ul>
</li>
<li class="BtTag">
<a href="#" >{$NomTag2}</a>
<ul class="GestTag">
<li><a href="index.php?/tags/{$IdTag1}" >{'CeTag'|@translate}</a></li>
<li><a href="index.php?/tags/{$IdTag2}" >{'AutreTag'|@translate}</a></li>
</ul>
</li>
</ul>
{* Si plus de deux Tag *}
{elseif ($nbElm)>3}
{assign var=numElm value=$nbElm-1}
{assign var="pos1" value=$Lst_tag_index[$numElm]|strpos:"["}
{assign var="NbPhoto" value=$Lst_tag_index[$numElm]|substr:($pos1+1):-1}
<ul>
{section name=foo loop=($Lst_tag_index) step=2 start=1}
{assign var="NoElmPair value=$smarty.section.foo.index+1}
{assign var="pos1" value=$Lst_tag_index[foo]|strpos:" >"}
{assign var="IdTag" value=$Lst_tag_index[foo]|substr:0:$pos1}
{assign var="NomTag" value=$Lst_tag_index[foo]|substr:$pos1+2}
{assign var="pos1" value=$NomTag|strpos:"</a>"}
{assign var="NomTag" value=$NomTag|substr:0:$pos1}
{assign var="pos1" value=$Lst_tag_index[$NoElmPair]|strpos:"style="}
{assign var="SupTag" value=$Lst_tag_index[$NoElmPair]|substr:0:$pos1}
(<li class="BtTag">
<a href="#" >{$NomTag}</a>
<ul class="GestTag">
<li><a href="index.php?/tags/{$IdTag}" >{'CeTag'|@translate}</a></li>
<li><a href="'index.php?/tags/{$SupTag}" >{'AutreTag'|@translate}</a></li>
</ul>
</li>)
{/section}
</ul>
{/if}
{/if}
|
please could you help me, to solve my problem
thanks |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Jan 22, 2014 4:26 pm Post subject: |
|
|
You have a missing double quote
Code: | {assign var="NoElmPair value=$smarty.section.foo.index+1} |
should be
Code: | {assign var="NoElmPair" value=$smarty.section.foo.index+1} |
|
|
Back to top |
|
patfrwar Smarty n00b
Joined: 22 Jan 2014 Posts: 2
|
Posted: Wed Jan 22, 2014 9:11 pm Post subject: |
|
|
hello
thank's you very much
you find the solve of my problem
it's great for me |
|
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
|