Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

OR and calculations?

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
me2
Smarty n00b


Joined: 13 Aug 2009
Posts: 3

PostPosted: Fri Aug 28, 2009 2:15 pm    Post subject: OR and calculations? Reply with quote

I used to do something like this to generate some cropped pagination:
Code:
{section name=paginas loop=$iMaxPages}
    {if $smarty.section.paginas.iteration < 14
      || $smarty.section.paginas.iteration > ($iMaxPages - 10)
      || ($smarty.section.paginas.iteration >= $iCurrentPage - 1 && $smarty.section.paginas.iteration <= $iCurrentPage + 1)}
         <li><a {if $smarty.section.paginas.iteration == $iCurrentPage}class="currentpage"{/if} href="{$url}{$smarty.section.paginas.iteration}">{$smarty.section.paginas.iteration}</a></li>
   {elseif $smarty.section.paginas.iteration == 14 && ($iCurrentPage - 14) > 0
      || $smarty.section.paginas.iteration == ($iMaxPages - 10)}
         <li>...</li>
     {/if}
{/section}


But with Smarty3 this gives me the following error:
Code:
Code: 0
Error: Syntax Error in template "/var/.../xxx.html" on line 25 " || $smarty.section.paginas.iteration > ($iMaxPages - 10)" - Unexpected " ", expected one of: "}" , "(&&,AND)" , "(||,OR)" , ISODD , ISNOTODD , ISEVEN , ISNOTEVEN , ISODDBY , ISNOTODDBY , ISEVENBY , ISNOTEVENBY , ISDIVBY , ISNOTDIVBY
File: /var/.../Smarty3Alpha/distribution/libs/sysplugins/internal.templatecompilerbase.php
Line: 264


Is this because of some syntax changes in Smarty3 or is this a bug? I hope it's a bug that's gonna get fixed!
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Fri Aug 28, 2009 6:38 pm    Post subject: Reply with quote

A fix for linebreaks inside {if} tags is in the SVN now
Back to top
View user's profile Send private message
Karel S.
Smarty Rookie


Joined: 03 Aug 2009
Posts: 26
Location: The Netherlands

PostPosted: Mon Aug 31, 2009 12:22 pm    Post subject: Reply with quote

And it works, thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 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