Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
In tags.php on the core github there is a tag
Code: Select all
 <cms:k_break/>
. Can this be used to break a pages loop?

consider the following code

Code: Select all
<cms:each data sep=','>
<cms:if k_first_item><cms:if k_total_items gt '1'><cms:set is_bulk = '1' 'global'/></cms:if></cms:if>
   
<cms:pages masterpage='shows.php' id=item limit='1'>
<cms:if (is_bulk = '1') && (author != k_user_title)><cms:k_break/></cms:if>

<cms:show k_page_title/>
</cms:pages>
</cms:each>



Would this work or would the k_break kill the each loop? The tags.php refers to a config of <cms:each> but I can't find any reference to that anywhere else
As of now, the <cms:break> tag is experimental and works only with <cms:each>.

So in your sample code, the <cms:pages> block will run to its full but when the controls return to <cms:each>, the break will take effect and the each loop will end.
So as I understand it the benefit of the <cms:k_break> tag at the moment is that it could speed up certain <cms:each> tag iterations where we only need the first few loops

E.g instead of
Code: Select all
<cms:each input><cms:if k_count = '1'><cms:show item/></cms:if></cms:each>


We could use

Code: Select all
<cms:each input><cms:show item/><cms:if k_count = '2'><cms:k_break/></cms:if></cms:each>


which would prevent iterating through the rest of the loops
That is correct.
<cms:break/> is also valid (without 'k_').
5 posts Page 1 of 1