About break

foreach ( $data as $k => $v ) {
  if ( $k == 4 ) {

every one knows.

Is there something similar in Smarty's or Dwoo's {foreach} function ?

Accepted Answer

You should put your logic in php, not in template. However, you can write your won compiler plugin:

function smarty_compiler_break($contents, &$smarty){
   return 'break;';

and save it to compiler.break.php in your plugins directory.

Now in template you can use {break}.

Written by Darmen
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki