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

Not matching {capture} open/close

 
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
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Thu Dec 01, 2011 7:15 pm    Post subject: Not matching {capture} open/close Reply with quote

index.html:
Code:
{include 'aaa.html' x=1}


aaa.html:
Code:
{if $x lt 5}
{$x}
{capture name='aaa'}{include 'aaa.html' x=$x+1}{/capture}
{/if}


Output:
Code:
1 2
Exception "Not matching {capture} open/close in "aaa.html""
Back to top
View user's profile Send private message
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Thu Dec 08, 2011 6:42 pm    Post subject: Reply with quote

Any ideas? Do you confirm this bug?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Thu Dec 08, 2011 7:33 pm    Post subject: Reply with quote

I can see why this error message is throw.

But what sense it does make either to open in a recurive {include} recursive {capture} stack.

What do you wnat to achive?
Back to top
View user's profile Send private message
douglassdavis
Smarty Junkie


Joined: 21 Jan 2008
Posts: 541

PostPosted: Thu Dec 08, 2011 7:37 pm    Post subject: Re: Not matching {capture} open/close Reply with quote

Out of curiosity... Does this work?

Code:
{if $x lt 5}
{$x}
{capture name="aaa$x"}{include 'aaa.html' x=$x+1}{/capture}
{/if}
Back to top
View user's profile Send private message
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Fri Dec 09, 2011 3:47 pm    Post subject: Reply with quote

U.Tews wrote:
But what sense it does make either to open in a recurive {include} recursive {capture} stack.


Recursion is common programming technique. Capture may be used for various reasons, for example - to check that captured data is not empty.

In any case:
1. the error message "Not matching {capture} open/close" is incorrect. The capture tag is properly closed.
2. this code used to work in Smarty 3.1.4.

douglassdavis wrote:
Out of curiosity... Does this work?


No, it does not.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Fri Dec 09, 2011 10:07 pm    Post subject: Reply with quote

The bugfix is now in the SVN trunk version and will later be included in 3.1.7
Back to top
View user's profile Send private message
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Sat Dec 10, 2011 6:43 am    Post subject: Reply with quote

Thx. Now it works Smile
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